From 286ebbfc4fc5e348ce287ca9b7d398b1ccacb0c5 Mon Sep 17 00:00:00 2001 From: VIEREGG Design - JFC Date: Fri, 2 Dec 2022 00:46:54 +0100 Subject: [PATCH] PHP 8.1: Check if value is_null before trim() --- FieldtypeColorPicker.module | 1 + InputfieldColorPicker.module | 1 + 2 files changed, 2 insertions(+) diff --git a/FieldtypeColorPicker.module b/FieldtypeColorPicker.module index 25bc4c4..4e0eb4b 100644 --- a/FieldtypeColorPicker.module +++ b/FieldtypeColorPicker.module @@ -57,6 +57,7 @@ class FieldtypeColorPicker extends Fieldtype { */ public function ___formatValue(Page $page, Field $field, $value){ + if(is_null($field->default)) $field->default=''; if(!$value) $value = trim($field->default); if(!strlen($value)) return $value; if(!$field->formatting) return $value; diff --git a/InputfieldColorPicker.module b/InputfieldColorPicker.module index 3fa5a30..5df5c83 100644 --- a/InputfieldColorPicker.module +++ b/InputfieldColorPicker.module @@ -62,6 +62,7 @@ class InputfieldColorPicker extends Inputfield { /** * add swatches for predefined color values | @Rayden */ + if(is_null($this->swatch)) $this->swatch=''; $swatch = trim($this->swatch); if(strlen($swatch)) {