[BUGFIX] Replace PHP 7.2 deprecated each() 83/55083/2
authorPatrick Schriner <patrick.schriner@diemedialen.de>
Thu, 14 Dec 2017 09:19:51 +0000 (10:19 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 14 Dec 2017 20:05:35 +0000 (21:05 +0100)
each() is deprecated in PHP 7.2 and has to be replaced.

Resolves: #83321
Releases: master, 8.7, 7.6
Change-Id: Ic318b50a9921cd6a55435cc9b2e0b254e61b9dbc
Reviewed-on: https://review.typo3.org/55083
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php

index 17a3661..f2e4821 100644 (file)
@@ -139,17 +139,22 @@ class ConditionMatcher extends AbstractConditionMatcher
         if ($id = (int)GeneralUtility::_GP('id')) {
             $pageId = $id;
         } elseif (is_array($editStatement)) {
-            list($table, $uidAndAction) = each($editStatement);
-            list($uid, $action) = each($uidAndAction);
+            $table = key($editStatement);
+            $uidAndAction = current($editStatement);
+            $uid = key($uidAndAction);
+            $action = current($uidAndAction);
             if ($action === 'edit') {
                 $pageId = $this->getPageIdByRecord($table, $uid);
             } elseif ($action === 'new') {
                 $pageId = $this->getPageIdByRecord($table, $uid, true);
             }
         } elseif (is_array($commandStatement)) {
-            list($table, $uidActionAndTarget) = each($commandStatement);
-            list($uid, $actionAndTarget) = each($uidActionAndTarget);
-            list($action, $target) = each($actionAndTarget);
+            $table = key($commandStatement);
+            $uidActionAndTarget = current($commandStatement);
+            $uid = key($uidActionAndTarget);
+            $actionAndTarget = current($uidActionAndTarget);
+            $action = key($actionAndTarget);
+            $target = current($actionAndTarget);
             if ($action === 'delete') {
                 $pageId = $this->getPageIdByRecord($table, $uid);
             } elseif ($action === 'copy' || $action === 'move') {