Using cached array length in `for`
authorAlexander Ebert <ebert@woltlab.com>
Thu, 26 May 2016 14:36:24 +0000 (16:36 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 26 May 2016 14:36:24 +0000 (16:36 +0200)
wcfsetup/install/files/lib/system/session/SessionHandler.class.php

index b14da1a4baa75e6db6ca06fbe611486fd4b1cb04..d6d9cf768ff3d3f1145f1c0cb7b19a53a3817471 100644 (file)
@@ -887,7 +887,7 @@ class SessionHandler extends SingletonFactory {
                                $data['parentPageID'] = null;
                                $data['parentPageObjectID'] = null;
                                
-                               for ($i = 1; $i < count($pageLocations); $i++) {
+                               for ($i = 1, $length = count($pageLocations); $i < $length; $i++) {
                                        if (!empty($pageLocations[$i]['useAsParentLocation'])) {
                                                $data['parentPageID'] = $pageLocations[$i]['pageID'];
                                                $data['parentPageObjectID'] = ($pageLocations[$i]['pageObjectID'] ?: null);