Bug #89103

impexp: sql error when strict_mode is enabled on database server

Added by DANIEL Rémy 3 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Import/Export (T3D)
Target version:
-
Start date:
2019-09-06
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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


Related issues

Related to TYPO3 Core - Epic #68397: Make TYPO3 work with MySQL strict mode Closed 2008-05-20

History

#1 Updated by DANIEL Rémy 3 months ago

  • Related to Epic #68397: Make TYPO3 work with MySQL strict mode added

Also available in: Atom PDF