[BUGFIX] Check whether contentElementCache for language and colPos is valid 38/47038/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 26 Feb 2016 20:13:17 +0000 (21:13 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 4 Mar 2016 10:40:39 +0000 (11:40 +0100)
It may happen that ``$this->contentElementCache[$lP][$colPos]`` is either not
an array nor null. Wrap the foreach loop with an if condition to catch possible
errors.

Change-Id: I6394ff0eef28a490a54f54d172c601fa9768eb20
Resolves: #73670
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/47038
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/View/PageLayoutView.php

index c2e2171..1dfca01 100644 (file)
@@ -1800,10 +1800,12 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
             }
         }
 
-        foreach ($this->contentElementCache[$lP][$colPos] as $record) {
-            $key = array_search($record['t3_origuid'], $defLanguageCount);
-            if ($key !== false) {
-                unset($defLanguageCount[$key]);
+        if (isset($this->contentElementCache[$lP][$colPos]) && is_array($this->contentElementCache[$lP][$colPos])) {
+            foreach ($this->contentElementCache[$lP][$colPos] as $record) {
+                $key = array_search($record['t3_origuid'], $defLanguageCount);
+                if ($key !== false) {
+                    unset($defLanguageCount[$key]);
+                }
             }
         }