From b737affd35d0a2ff26f100bb9bbedce6c68a9f03 Mon Sep 17 00:00:00 2001 From: Paul Coudeville Date: Fri, 1 Mar 2024 18:38:59 +0100 Subject: [PATCH] fix(fieldcore): notice when a field with a collection is saved on backoffice without default value, a notice is triggered (1/1) ContextErrorException Notice: Trying to access array offset on value of type null in FieldCore.php line 609 --- classes/prettyblocks/core/FieldCore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/prettyblocks/core/FieldCore.php b/classes/prettyblocks/core/FieldCore.php index 5372f1de..2c90595f 100644 --- a/classes/prettyblocks/core/FieldCore.php +++ b/classes/prettyblocks/core/FieldCore.php @@ -605,7 +605,7 @@ public function formatFieldSelectorForFront() return $this->_getCollection($idCollection, $this->collection); } // if value doesn't exists in DB and new value is set - if ($this->force_default_value && $this->new_value == '') { + if ($this->force_default_value && $this->new_value === '' && is_array($this->default) && isset($this->default['show']['id'])) { $idCollection = (int) $this->default['show']['id']; return $this->_getCollection($idCollection, $this->collection);