From e6878a52487c4454bb7a2943d722e31f240c5689 Mon Sep 17 00:00:00 2001 From: Wouter Wolters <typo3@wouterwolters.nl> Date: Tue, 14 Nov 2017 19:05:15 +0100 Subject: [PATCH] [BUGFIX] Use correct parameters for trimExplode In QueryBuilder::quoteIdentifiersForSelect the 3rd parameter of trimExplode is inserted. To prevent notices array_pad is added. Resolves: #82995 Releases: master,8.7 Change-Id: If35efcf5c8c3fd5b0360ae8795f9b92ae87250ab Reviewed-on: https://review.typo3.org/54640 Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org> Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com> Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com> --- .../core/Classes/Database/Query/QueryBuilder.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php b/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php index 0d013045a0f3..45db0f8d132c 100644 --- a/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php +++ b/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php @@ -969,7 +969,16 @@ class QueryBuilder public function quoteIdentifiersForSelect(array $input): array { foreach ($input as &$select) { - list($fieldName, $alias, $suffix) = GeneralUtility::trimExplode(' AS ', str_ireplace(' as ', ' AS ', $select), 3); + list($fieldName, $alias, $suffix) = array_pad( + GeneralUtility::trimExplode( + ' AS ', + str_ireplace(' as ', ' AS ', $select), + true, + 3 + ), + 3, + null + ); if (!empty($suffix)) { throw new \InvalidArgumentException( 'QueryBuilder::quoteIdentifiersForSelect() could not parse the input "' . $input . '"', -- GitLab