Skip to content

Commit 4da93e3

Browse files
committed
fix(glpiselectfield,dropdownfield): prevent php warning
1 parent 63999d0 commit 4da93e3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

inc/field/dropdownfield.class.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ private function getMyGroups($userID) {
602602
}
603603

604604
public function equals($value): bool {
605-
$value = html_entity_decode($value);
605+
$value = html_entity_decode($value ?? '');
606606
$itemtype = $this->question->fields['itemtype'];
607607
$dropdown = new $itemtype();
608608
if ($dropdown->isNewId($this->value)) {
@@ -624,7 +624,7 @@ public function notEquals($value): bool {
624624
}
625625

626626
public function greaterThan($value): bool {
627-
$value = html_entity_decode($value);
627+
$value = html_entity_decode($value ?? '');
628628
$itemtype = $this->question->fields['itemtype'];
629629
$dropdown = new $itemtype();
630630
if (!$dropdown->getFromDB($this->value)) {
@@ -643,7 +643,7 @@ public function lessThan($value): bool {
643643
}
644644

645645
public function regex($value): bool {
646-
$value = html_entity_decode($value);
646+
$value = html_entity_decode($value ?? '');
647647
$itemtype = $this->question->fields['itemtype'];
648648
$dropdown = new $itemtype();
649649
if (!$dropdown->getFromDB($this->value)) {

inc/field/glpiselectfield.class.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function buildParams($rand = null) {
160160
}
161161

162162
public function equals($value): bool {
163-
$value = html_entity_decode($value);
163+
$value = html_entity_decode($value ?? '');
164164
$itemtype = $this->getSubItemtype();
165165
$item = new $itemtype();
166166
if ($item->isNewId($this->value)) {
@@ -177,7 +177,7 @@ public function notEquals($value): bool {
177177
}
178178

179179
public function greaterThan($value): bool {
180-
$value = html_entity_decode($value);
180+
$value = html_entity_decode($value ?? '');
181181
$itemtype = $this->getSubItemtype();
182182
$item = new $itemtype();
183183
if (!$item->getFromDB($this->value)) {

0 commit comments

Comments
 (0)