[BUGFIX] Prevent building empty IN () query by throwing exception
authorBenjamin Bretz <pleaserebootuniverse@googlemail.com>
Fri, 12 Apr 2013 15:30:45 +0000 (17:30 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 12 Apr 2013 19:48:32 +0000 (21:48 +0200)
If $storagePageIds is empty Typo3DbBackend::addPageIdStatement()
InconsistentQuerySettingsException is thrown instead of creating
an invalid query

Fixes: #47167
Releases: 6.1, 6.0, 1.3
Change-Id: Ib52884573c9a09b791c0b090daaffc9b7d15b6a1
Reviewed-on: https://review.typo3.org/19861
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php

index 5ea5dec..440b9ce 100644 (file)
@@ -1007,6 +1007,9 @@ class Typo3DbBackend implements \TYPO3\CMS\Extbase\Persistence\Generic\Storage\B
                                        $sql['additionalWhereClause'][] = $tableName . '.pid = 0';
                                }
                        } else {
+                               if (empty($storagePageIds)) {
+                                       throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InconsistentQuerySettingsException('Missing storage page ids.', 1365779762);
+                               }
                                $sql['additionalWhereClause'][] = $tableName . '.pid IN (' . implode(', ', $storagePageIds) . ')';
                        }
                }