quickapps / cms

Modular CMS powered by CakePHP
GNU General Public License v3.0
164 stars 69 forks source link

PDOException Field 'public_profile' doesn't have a default value #190

Open lightbyte opened 6 years ago

lightbyte commented 6 years ago

In the start up fase, after submit the information for the admin user I got this error:

Error An Internal Error Has Occurred.

And in the logs I have this:

Error: [PDOException] SQLSTATE[HY000]: General error: 1364 Field 'public_profile' doesn't have a default value
Request URL: /source/installer/startup/account?locale=es_ES

And after set the default value to that field I got the same error for these other fields:

'public_email' 'token' 'last_login'

After set up default values or NULL in case of 'token' it worked.

botchris commented 6 years ago

Seems your MySQL instance is using "strict" mode, try to disable it: https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

lightbyte commented 6 years ago

I've checked the sql mode following this instructions: https://stackoverflow.com/a/40889485/1331068 and it returns this: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION By now, I'm developing locally and I can change that param but I'm not sure if I can change it in production server. I will try to see if that avoids the error, but it should be solved, don't you think?

lightbyte commented 6 years ago

I've removed STRICT_TRANS_TABLES from sql_mode, then removed database and source files. Then I've created the project with composer command composer create-project -s dev quickapps/website [website_name]. Now it didn't fail in user creation. Should it work with strict mode on?

botchris commented 6 years ago

QACMS at its time was designed with MySQL 5.6 in mind. Seems you are using MySQL 5.7 which includes a bunch of sql-mode directives by default. Prior to 5.7 there were no default directives at all.

So it is pretty unlikely I can "fix" this, as this affects QACMS's core and every existing plugin.

lightbyte commented 6 years ago

I'm using vagrant server with mysql 5.6 and it was configured as it was by default.

botchris commented 6 years ago

https://dev.mysql.com/doc/refman/5.6/en/faqs-sql-modes.html#faq-mysql-what-default-mode

lightbyte commented 6 years ago

Then should I set sql_mode = NO_ENGINE_SUBSTITUTION only for QACMS to work properly?

botchris commented 6 years ago

Yes, sql_mode = NO_ENGINE_SUBSTITUTION.

However I'll try to identify all those columns and fix them all at once.