[BUGFIX] Incorrect usages of string as array in QueryGenerator 15/51915/8
authorChrister Vindberg <cvi@systime.dk>
Wed, 1 Mar 2017 11:46:47 +0000 (12:46 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Sat, 4 Mar 2017 02:18:29 +0000 (03:18 +0100)
Changed so an empty $queryConfig is always an array.

$queryConfig is declared as an array but can be used as an array or
string, therefore in PHP 7.1 an exception was thrown.

Resolves: #80075
Releases: master, 7.6
Change-Id: Ifd8b89e0ccce4f93a6c7bee5afe10bf52fa73634
Reviewed-on: https://review.typo3.org/51915
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/core/Classes/Database/QueryGenerator.php

index 3ab572c..bf95cb0 100644 (file)
@@ -543,7 +543,9 @@ class QueryGenerator
             ksort($queryConfig);
         } else {
             // queryConfig should never be empty!
-            if (!$queryConfig[0] || !$queryConfig[0]['type']) {
+            if (!isset($queryConfig[0]) || empty($queryConfig[0]['type'])) {
+                // Make sure queryConfig is an array
+                $queryConfig = [];
                 $queryConfig[0] = ['type' => 'FIELD_'];
             }
         }