PHP PDO or MYSQL is forcing me, from one day to the next, to save fields not null
from a table, before, if it was an integer, mysql automatically put a 0
.
I explain.
I have this table: customers
id int auto incremental not null
nombre text not null
apellidos text not null
id_usuario int not null
And this is my query:
INSERT INTO clientes(nombre, apellidos) VALUES(:nombre, :apellidos)
This query 1 day ago, without changing the code, it worked fine for me, it filled the fields nombre
and apellidos
automatically filled the id
auto-incrementing field and the field id_usuario
put a 0 automatically mysql. And it didn't give any error.
Today, it doesn't work anymore, it gives me the following error:
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1364 Field 'id_usuario' doesn't have a default value.
It is also happening to me with empty strings, before if I passed an empty string to a field int
, it automatically interpreted it as nothing and put the value 0
. Now it gives the error:
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ''
I think that Mysql has become restrictive from one day to the next, I don't know if it has been updated by itself or what has happened... is there any way to change this so that it is like before?
EDIT: Seeing the log in Ubuntu, today at 6 am Mysql has been updated from version 5.7.21 to 5.7.22. It sure has something to do with it.
Greetings and thanks.