[BUGFIX] Allow NULL values in INSERT queries 22/25422/2
authorAlexander Stehlik <alexander.stehlik@googlemail.com>
Fri, 15 Nov 2013 13:06:13 +0000 (14:06 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Sat, 4 Jan 2014 14:36:02 +0000 (15:36 +0100)
Currently only UPDATE queries pass the $allowNull parameter to the
fullQuoteStr() method in the DatabaseHandler. To make the behavior of
both methods consistent and to allow NULL values during creation of
new records by TCEmain the $allowNull parameter is also set to TRUE for
INSERT queries.

Resolves: #53662
Releases: 6.2, 6.1, 6.0
Change-Id: I066b9880a557b6c9058fc15f467631f1313300f9
Reviewed-on: https://review.typo3.org/25422
Reviewed-by: Philipp Gampe
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Xavier Perseguers
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/core/Classes/Database/DatabaseConnection.php

index 51a7f93..8bcfb42 100644 (file)
@@ -474,7 +474,7 @@ class DatabaseConnection {
                                $hookObject->INSERTquery_preProcessAction($table, $fields_values, $no_quote_fields, $this);
                        }
                        // Quote and escape values
-                       $fields_values = $this->fullQuoteArray($fields_values, $table, $no_quote_fields);
+                       $fields_values = $this->fullQuoteArray($fields_values, $table, $no_quote_fields, TRUE);
                        // Build query
                        $query = 'INSERT INTO ' . $table . ' (' . implode(',', array_keys($fields_values)) . ') VALUES ' . '(' . implode(',', $fields_values) . ')';
                        // Return query