Bug #68562

Epic #68397: Make TYPO3 work with MySQL strict mode

Bool values need to be cast to integer for MySQL strict mode

Added by Morton Jonuschat almost 4 years ago. Updated over 1 year ago.

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

100%

TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

MySQL strict mode doesn't accept '' as a valid value to store in an integer column if the MySQL is run in strict mode.
Boolean values are cast by mysqli_real_escape string to '1' (for TRUE) and '' (for FALSE). Due to this special handling is required for boolean values to result in '0' and '1' for FALSE/TRUE


Related issues

Related to TYPO3 Core - Bug #68418: scheduler chokes on mysql strict mode Closed 2015-07-21
Related to TYPO3 Core - Bug #68602: NULL values in records get transformed to FALSE on T3D import Closed 2015-07-29

Associated revisions

Revision cc72fd7e (diff)
Added by Morton Jonuschat almost 4 years ago

[BUGFIX] Database API: Cast bool values to integer for MySQL

Convert boolean values to integers before processing them with
mysqli_real_escape_string() to ensure that FALSE values get converted to
'0' instead of '', which isn't a valid value for integer columns in
MySQL strict mode.

Resolves: #68562
Releases: master
Change-Id: I974ebe6bc82ab54d2dd89a792536b0401eb1c81e
Reviewed-on: http://review.typo3.org/41993
Reviewed-by: Wouter Wolters <>
Reviewed-by: Daniel Goerz <>
Reviewed-by: Tomas Norre Mikkelsen <>
Tested-by: Daniel Goerz <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>

Revision e4ee3f0b (diff)
Added by Morton Jonuschat almost 4 years ago

[BUGFIX] DataHandler: cast value to string in checkValueForInput()

Explicitly cast the value as a string before using substr() on it.
Otherwise NULL values would be passed to substr(), resulting in a return
value of FALSE. Without MySQL strict mode this has no direct influence
on the further usage of the value as string as the string representation
of FALSE is an empty string. With MySQL strict mode enabled this leads
to errors upon insertion of records into the database as boolean values
get converted to 0/1 respectively.

Resolves: #68602
Related: #68562
Related: #55082
Releases: master
Change-Id: Idc3ffa147965083492a04b12c64a6c15ddd2277b
Reviewed-on: http://review.typo3.org/42260
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>
Reviewed-by: Frank Nägler <>
Tested-by: Frank Nägler <>

Revision 748c8294 (diff)
Added by Morton Jonuschat almost 4 years ago

[!!!][BUGFIX] Database API: Cast bool values to integer for MySQL

Convert boolean values to integers before processing them with
mysqli_real_escape_string() to ensure that FALSE values get converted to
'0' instead of '', which isn't a valid value for integer columns in
MySQL strict mode.

Resolves: #68562
Releases: master
Change-Id: Iefbdce55d872a94ad98bd2b9fa66627830725084
Reviewed-on: http://review.typo3.org/42376
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>

History

#1 Updated by Morton Jonuschat almost 4 years ago

  • Status changed from New to In Progress

#2 Updated by Gerrit Code Review almost 4 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/41993

#3 Updated by Morton Jonuschat almost 4 years ago

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

#4 Updated by Christian Kuhn almost 4 years ago

  • Status changed from Resolved to New

patch was unfortunately reverted with https://review.typo3.org/#/c/42076/

#5 Updated by Morton Jonuschat almost 4 years ago

After discussion with Stefan Neufeind the initial implementation is still the best way to go, but the bug(s) in EXT:impexp need to be fixed first. Additionally this should be marked as breaking to be on the safe side.

#7 Updated by Gerrit Code Review almost 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42376

#8 Updated by Morton Jonuschat almost 4 years ago

  • Status changed from Under Review to Resolved

#9 Updated by Riccardo De Contardi over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF