Bug #52596

Creating pages tries to assign empty string to integer field

Added by Tomas Norre Mikkelsen about 6 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2013-10-07
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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


Related issues

Related to TYPO3 Core - Bug #18866: Cannot create page with Mysl in strict mode (STRICT_TRANS_TABLES) Rejected 2008-05-28

Associated revisions

Revision 2cfefec4 (diff)
Added by Alexander Stehlik almost 6 years ago

[BUGFIX] Correct handling of empty Backend Layouts

Since the default value of the page properties backend_layout and
backend_layout_next_level is an empty string the value in the select
item is changed from zero to an empty string for consistency.

Additionally the BackendLayoutView will treat an empty string equally
as a zero namely as a non set Backend Layout.

Resolves: #52596
Releases: 6.2
Change-Id: Ic792f748d005f5749f24a3e979b304c23320c8fa
Reviewed-on: https://review.typo3.org/24882
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer

History

#1 Updated by Alexander Stehlik about 6 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:

  1. change the default value of backend_layout and backend_layout_next_level back to zero
  2. 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.

#2 Updated by Gerrit Code Review about 6 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

#3 Updated by Gerrit Code Review about 6 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24882

#4 Updated by Gerrit Code Review about 6 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

#5 Updated by Gerrit Code Review almost 6 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

#6 Updated by Alexander Stehlik almost 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF