[BUGFIX] PreparedStatement: count() must be an array or countable 11/54911/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 3 Dec 2017 12:09:08 +0000 (13:09 +0100)
committerBenni Mack <benni@typo3.org>
Sun, 3 Dec 2017 12:38:58 +0000 (13:38 +0100)
Sanitize a count() call in PreparedStatement (8.7, 7.6 only)
for PHP 7.2 compatibility.

Change-Id: I8d3cac3814093c7223c6be8f8ab8dc8c610d28e1
Resolves: #83196
Releases: 8.7, 7.6
Reviewed-on: https://review.typo3.org/54911
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Classes/Database/PreparedStatement.php

index 01460af..052033e 100644 (file)
@@ -603,7 +603,7 @@ class PreparedStatement
      */
     protected function convertNamedPlaceholdersToQuestionMarks(&$query, array &$parameterValues, array &$precompiledQueryParts)
     {
-        $queryPartsCount = count($precompiledQueryParts['queryParts']);
+        $queryPartsCount = is_array($precompiledQueryParts['queryParts']) ? count($precompiledQueryParts['queryParts']) : 0;
         $newParameterValues = [];
         $hasNamedPlaceholders = false;