From 27dc8ffb456d6403eaa6a28327fbcf5aac04e905 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 9 Apr 2021 14:45:05 +0300 Subject: [PATCH] Fixed fatal error if `system.pages.types` is not an array [#2984](https://github.com/getgrav/grav/issues/2984) --- CHANGELOG.md | 1 + system/src/Grav/Common/Utils.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d57ed7f8..da12f46ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Fixed deleting page with language code not removing the folder if it was the last language [#3305](https://github.com/getgrav/grav/issues/3305) * Fixed fatal error when using markdown links with `image://` stream [#3285](https://github.com/getgrav/grav/issues/3285) * Fixed `system.languages.session_store_active` not having any effect [#3269](https://github.com/getgrav/grav/issues/3269) + * Fixed fatal error if `system.pages.types` is not an array [#2984](https://github.com/getgrav/grav/issues/2984) # v1.7.10 ## 04/06/2021 diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index 0350d2209..51eaf42ef 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -1844,11 +1844,14 @@ abstract class Utils * Wrapper to ensure html, htm in the front of the supported page types * * @param array|null $defaults - * @return array|mixed + * @return array */ public static function getSupportPageTypes(array $defaults = null) { $types = Grav::instance()['config']->get('system.pages.types', $defaults); + if (!is_array($types)) { + return []; + } // remove html/htm $types = static::arrayRemoveValue($types, ['html', 'htm']);