Bug #52596
closedCreating pages tries to assign empty string to integer field
100%
Description
Hi,
I recently discovered an issue after upgrading to MySQL 5.6 when creating pages.
When creating a page, following $fieldArray is tried to be inserted.
array (\n 'doktype' => '1',\n 'hidden' => '1',\n 'starttime' => '0',\n 'endtime' => '0',\n 'layout' => '0',\n 'url_scheme' => 0,\n 'urltype' => '1',\n 'lastUpdated' => '0',\n 'newUntil' => '0',\n 'cache_timeout' => '0',\n 'shortcut_mode' => '0',\n 'module' => '',\n 'backend_layout' => '',\n 'backend_layout_next_level' => '',\n 'perms_userid' => '1',\n 'perms_groupid' => 0,\n 'perms_user' => 31,\n 'perms_group' => 27,\n 'perms_everybody' => 0,\n 'sorting' => 256,\n 'pid' => 0,\n 'title' => '[Default Title]',\n 'crdate' => 1381052264,\n 'cruser_id' => '1',\n 'tstamp' => 1381052264,\n 't3ver_stage' => 0,\n ),
Which is ok, but the backend_layout and backend_layout_next_level fields are both set as empty strings '', which is tried to set into integer fields. This is a problem with MySQL 5.6 default setup cause it uses: sql_mode=STRICT_TRANS_TABLES ( or at least in osx it does)
This can for sure just be changes, but it might be a wanted configuration for some and it should be supported by TYPO3 too.
The "issue" as I see it is:
Why try to assign an empty string to an integer field. If the wanted behaviour is that it should be the default values, these should not be set in the fieldArray but be handled by the table definitions.
I don't have a solution for this, just wanted to address the issue.
I'll be glad helping figuring out this issue. But the main idea was to address the issue so we know which direction we should go.
Cheers
Is for sure related to:
http://forge.typo3.org/issues/18866
Updated by Alexander Stehlik about 11 years ago
There seems to be a general problem with Backend Layouts for new pages. When a new page is created the fields in the database backend_layout
and backend_layout_next_level
contain empty strings.
But the BackendLayoutView
only checks for values === '0'
when searching for pages with no explicit Backend Layout. So when if finds an empty string it will assume that there is a Backend Layout set in that page (which of course is not).
I see two solutions for that problem:
- change the default value of
backend_layout
andbackend_layout_next_level
back to zero - change the value in the Backend Layout selector also to an empty string instead of zero and adjust the check in
BackendLayoutView
so that it can handle empty strings
Remark on the second solution:
We need either to handle empty strings AND zeros to be backward compatible or we need an updater in the install tool.
Updated by Gerrit Code Review about 11 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24882
Updated by Gerrit Code Review about 11 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24882
Updated by Gerrit Code Review almost 11 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/24882
Updated by Gerrit Code Review almost 11 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/24882
Updated by Alexander Stehlik almost 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 2cfefec46e617e95fc350e3eaeb5304f6e91b882.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed