diff --git a/system/src/Grav/Common/Config.php b/system/src/Grav/Common/Config.php index b8a646fe1..e467ab8b9 100644 --- a/system/src/Grav/Common/Config.php +++ b/system/src/Grav/Common/Config.php @@ -55,7 +55,7 @@ class Config extends Data { // Build file map. $files = $this->build(); - $key = md5(serialize($files) . GRAV_VERSION); + $key = md5(json_encode($files) . GRAV_VERSION); if ($force || $key != $this->key) { // First take non-blocking lock to the file. diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index fb45bc897..dda35ef01 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -173,7 +173,7 @@ class Pages { $items = $collection->toArray(); - $lookup = md5(serialize($items)); + $lookup = md5(json_encode($items)); if (!isset($this->sort[$lookup][$orderBy])) { $this->buildSort($lookup, $items, $orderBy, $orderManual); } diff --git a/system/src/Grav/Common/TwigExtension.php b/system/src/Grav/Common/TwigExtension.php index 7cb241bb9..9cfff0a83 100644 --- a/system/src/Grav/Common/TwigExtension.php +++ b/system/src/Grav/Common/TwigExtension.php @@ -126,7 +126,8 @@ class TwigExtension extends \Twig_Extension $random = array_slice($original, $offset); shuffle($random); - for ($x=0; $x < sizeof($original); $x++) { + $sizeOf = sizeof($original); + for ($x=0; $x < $sizeOf; $x++) { if ($x < $offset) { $sorted[] = $original[$x]; } else {