Epic #68397: Make TYPO3 work with MySQL strict mode
Adding Objects with NOT NULL columns is broken
Using the Blog example from the functional tests it is easy to reproduce with a database that is strict about NOT NULL values (MySQL in strict mode, PostgreSQL and probably any other database that actually cares about data).
When adding a new Blog object the persistence layer tries to first create a new record just consisting of the following fields: crdate,tstamp,pid,sys_language_uid
As there are NOT NULL columns without default values in the table definition of the blog database this leads to constraint validation errors.
MySQL (strict mode) reports: Field 'description' doesn't have a default value
PostgreSQL reports: ERROR: null value in column "description" violates not-null constraint
This seems to originate in \TYPO3\CMS\Extbase\Persistence\Generic\Backend::persistObjects where new objects are treated specially by calling \TYPO3\CMS\Extbase\Persistence\Generic\Backend::insertObject which does not seem to map any of the object properties into the record to be created.
How to reproduce:
1. Add the following line to typo3/sysext/core/Build/Configuration/FunctionalTestsConfiguration.php: 'setDBinit' => 'SET SESSION sql_mode = \'STRICT_ALL_TABLES\';',
2. Run the following functional test: typo3/sysext/extbase/Tests/Functional/Persistence/AddTest.php
It will fail with SqlErrorException: Field 'description' doesn't have a default value