From b4630aeb38fc4aa19fae03b4e00942fe7a8b8e7d Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 21 Jan 2020 21:38:36 +0200 Subject: [PATCH] Fixed `Blueprint::filter()` returning null instead of array if there is nothing to return --- CHANGELOG.md | 1 + system/src/Grav/Common/Data/Blueprint.php | 2 +- system/src/Grav/Common/Data/BlueprintSchema.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc9f70db..0a442f0f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ * Fixed `{{ false|string }}` twig to return '0' instead of '' * Fixed `Data::filter()` removing empty fields (such as empty list) by default * Fixed twig `url()` failing if stream has extra slash in it (e.g. `user:///data`) + * Fixed `Blueprint::filter()` returning null instead of array if there is nothing to return * Grav 1.7: Fixed `Flex Pages` unserialize issues if Flex-Objects Plugin has not been installed * Grav 1.7: Require Flex-Objects Plugin to edit Flex Accounts diff --git a/system/src/Grav/Common/Data/Blueprint.php b/system/src/Grav/Common/Data/Blueprint.php index 6ec4965b1..c58e8e974 100644 --- a/system/src/Grav/Common/Data/Blueprint.php +++ b/system/src/Grav/Common/Data/Blueprint.php @@ -210,7 +210,7 @@ class Blueprint extends BlueprintForm { $this->initInternals(); - return $this->blueprintSchema->filter($data, $missingValuesAsNull, $keepEmptyValues); + return $this->blueprintSchema->filter($data, $missingValuesAsNull, $keepEmptyValues) ?? []; } diff --git a/system/src/Grav/Common/Data/BlueprintSchema.php b/system/src/Grav/Common/Data/BlueprintSchema.php index b4c708784..74eab25f6 100644 --- a/system/src/Grav/Common/Data/BlueprintSchema.php +++ b/system/src/Grav/Common/Data/BlueprintSchema.php @@ -84,7 +84,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface */ public function filter(array $data, $missingValuesAsNull = false, $keepEmptyValues = false) { - return $this->filterArray($data, $this->nested, $missingValuesAsNull, $keepEmptyValues); + return $this->filterArray($data, $this->nested, $missingValuesAsNull, $keepEmptyValues) ?? []; } /**