From 92b586c6c1c425013ebb01fc3de513fb458d2bb2 Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Sun, 3 Dec 2017 13:09:08 +0100
Subject: [PATCH] [BUGFIX] PreparedStatement: count() must be an array or
 countable

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/54912
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/core/Classes/Database/PreparedStatement.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/Database/PreparedStatement.php b/typo3/sysext/core/Classes/Database/PreparedStatement.php
index fe1e5f995f91..d1db63254cfc 100644
--- a/typo3/sysext/core/Classes/Database/PreparedStatement.php
+++ b/typo3/sysext/core/Classes/Database/PreparedStatement.php
@@ -597,7 +597,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;
 
-- 
GitLab