[BUGFIX] Check if at least one table is selected for cleanup 66/41066/3
authorDavid Greiner <hallo@davidgreiner.de>
Thu, 9 Jul 2015 22:02:36 +0000 (00:02 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 9 Jul 2015 22:07:15 +0000 (00:07 +0200)
Check if value to iterate over is set and is array. Without this
check the install tool breaks if no table is selected for cleanup
and displayErrors is set >= 1.

Resolves: #68030
Releases: master
Change-Id: I8af5c91107c70210001726cfb90e0e446f3e2450
Reviewed-on: http://review.typo3.org/41066
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php

index e953bc1..96d8abf 100644 (file)
@@ -127,10 +127,12 @@ class CleanUp extends Action\AbstractAction {
        protected function clearSelectedTables() {
                $clearedTables = array();
                $database = $this->getDatabaseConnection();
-               foreach ($this->postValues['values'] as $tableName => $selected) {
-                       if ($selected == 1) {
-                               $database->exec_TRUNCATEquery($tableName);
-                               $clearedTables[] = $tableName;
+               if (isset($this->postValues['values']) && is_array($this->postValues['values'])) {
+                       foreach ($this->postValues['values'] as $tableName => $selected) {
+                               if ($selected == 1) {
+                                       $database->exec_TRUNCATEquery($tableName);
+                                       $clearedTables[] = $tableName;
+                               }
                        }
                }
                if (!empty($clearedTables)) {