[BUGFIX] Database API: Cast bool values to integer for MySQL 93/41993/2
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Mon, 27 Jul 2015 18:18:20 +0000 (20:18 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 28 Jul 2015 20:33:58 +0000 (22:33 +0200)
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 <typo3@wouterwolters.nl>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Tomas Norre Mikkelsen <tomasnorre@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/core/Classes/Database/DatabaseConnection.php

index d16a929..a5d7493 100644 (file)
@@ -816,6 +816,9 @@ class DatabaseConnection {
                if ($allowNull && $str === NULL) {
                        return 'NULL';
                }
+               if (is_bool($str)) {
+                       $str = (int)$str;
+               }
 
                return '\'' . $this->link->real_escape_string($str) . '\'';
        }