diff --git a/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php b/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php
index 0d013045a0f39686b5cd312f3fd7ce08ace5aa42..45db0f8d132c4cb80a4046c3ecc36a807dfa75fd 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 . '"',