Bug #89103
closedimpexp: sql error when strict_mode is enabled on database server
100%
Description
When strict mode [1] is enabled on the database server, if a value has a wrong data type for the column, the INSERT or UPDATE query will fail.
This happens in t3d import.
During an import:
- first, records are stored without their relations
- then relations are stored
- and finaly, records and relations are connected together
The offending code is in \TYPO3\CMS\Impexp\Import::addSingle():
$this->import_data[$table][$ID][$field] = '';
Here, if $field is an integer in the database, the INSERT query will fail.
The relations records will not be created, and the t3d import will failed, leading to an inconsistent state of records in database.
The code should be fixed in order to guess the right datatype to store in the database.
Note: this bug was found when exporting/importing mask content elements with repeatable elements.
See also https://github.com/Gernott/mask/pull/249
[1] https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-strict