From 33a57099038a30aa8001d908abaa08b37943c228 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 20 Oct 2021 10:24:00 +0300 Subject: [PATCH] Fixed a bug in `PermissionsReader` in PHP 7.3 --- CHANGELOG.md | 6 ++++++ system/src/Grav/Common/Security.php | 8 ++------ system/src/Grav/Framework/Acl/PermissionsReader.php | 2 +- system/src/Grav/Framework/Flex/Storage/FolderStorage.php | 8 ++------ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 510ec6591..d087c242d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.24 +## mm/dd/2021 + +3. [](#bugfix) + * Fixed a bug in `PermissionsReader` in PHP 7.3 + # v1.7.23 ## 09/29/2021 diff --git a/system/src/Grav/Common/Security.php b/system/src/Grav/Common/Security.php index 833e64808..55aa54593 100644 --- a/system/src/Grav/Common/Security.php +++ b/system/src/Grav/Common/Security.php @@ -138,7 +138,7 @@ class Security $options = static::getXssDefaults(); } - $list = []; + $list = [[]]; foreach ($array as $key => $value) { if (is_array($value)) { $list[] = static::detectXssFromArray($value, $prefix . $key . '.', $options); @@ -148,11 +148,7 @@ class Security } } - if (!empty($list)) { - return array_merge(...$list); - } - - return $list; + return array_merge(...$list); } /** diff --git a/system/src/Grav/Framework/Acl/PermissionsReader.php b/system/src/Grav/Framework/Acl/PermissionsReader.php index 2c38afbea..4f4a6a317 100644 --- a/system/src/Grav/Framework/Acl/PermissionsReader.php +++ b/system/src/Grav/Framework/Acl/PermissionsReader.php @@ -131,7 +131,7 @@ class PermissionsReader */ protected static function getDependencies(array $dependencies): array { - $list = []; + $list = [[]]; foreach ($dependencies as $name => $deps) { $current = $deps ? static::getDependencies($deps) : []; $current[] = $name; diff --git a/system/src/Grav/Framework/Flex/Storage/FolderStorage.php b/system/src/Grav/Framework/Flex/Storage/FolderStorage.php index 5b4f9f386..ff2c94d7a 100644 --- a/system/src/Grav/Framework/Flex/Storage/FolderStorage.php +++ b/system/src/Grav/Framework/Flex/Storage/FolderStorage.php @@ -634,7 +634,7 @@ class FolderStorage extends AbstractFilesystemStorage $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS; $iterator = new FilesystemIterator($path, $flags); - $list = []; + $list = [[]]; /** @var SplFileInfo $info */ foreach ($iterator as $filename => $info) { if (!$info->isDir() || strpos($info->getFilename(), '.') === 0) { @@ -644,11 +644,7 @@ class FolderStorage extends AbstractFilesystemStorage $list[] = $this->buildIndexFromFilesystem($filename); } - if (!$list) { - return []; - } - - return count($list) > 1 ? array_merge(...$list) : $list[0]; + return array_merge(...$list); } /**