From 4da93e38e785365af884f9fbd2f7c8bd9ae05a22 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Mon, 30 Oct 2023 14:02:27 +0100 Subject: [PATCH] fix(glpiselectfield,dropdownfield): prevent php warning --- inc/field/dropdownfield.class.php | 6 +++--- inc/field/glpiselectfield.class.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/inc/field/dropdownfield.class.php b/inc/field/dropdownfield.class.php index 11400c597..d725b0d9d 100644 --- a/inc/field/dropdownfield.class.php +++ b/inc/field/dropdownfield.class.php @@ -602,7 +602,7 @@ private function getMyGroups($userID) { } public function equals($value): bool { - $value = html_entity_decode($value); + $value = html_entity_decode($value ?? ''); $itemtype = $this->question->fields['itemtype']; $dropdown = new $itemtype(); if ($dropdown->isNewId($this->value)) { @@ -624,7 +624,7 @@ public function notEquals($value): bool { } public function greaterThan($value): bool { - $value = html_entity_decode($value); + $value = html_entity_decode($value ?? ''); $itemtype = $this->question->fields['itemtype']; $dropdown = new $itemtype(); if (!$dropdown->getFromDB($this->value)) { @@ -643,7 +643,7 @@ public function lessThan($value): bool { } public function regex($value): bool { - $value = html_entity_decode($value); + $value = html_entity_decode($value ?? ''); $itemtype = $this->question->fields['itemtype']; $dropdown = new $itemtype(); if (!$dropdown->getFromDB($this->value)) { diff --git a/inc/field/glpiselectfield.class.php b/inc/field/glpiselectfield.class.php index 8450f7e8d..71a1f67dd 100644 --- a/inc/field/glpiselectfield.class.php +++ b/inc/field/glpiselectfield.class.php @@ -160,7 +160,7 @@ public function buildParams($rand = null) { } public function equals($value): bool { - $value = html_entity_decode($value); + $value = html_entity_decode($value ?? ''); $itemtype = $this->getSubItemtype(); $item = new $itemtype(); if ($item->isNewId($this->value)) { @@ -177,7 +177,7 @@ public function notEquals($value): bool { } public function greaterThan($value): bool { - $value = html_entity_decode($value); + $value = html_entity_decode($value ?? ''); $itemtype = $this->getSubItemtype(); $item = new $itemtype(); if (!$item->getFromDB($this->value)) {