Skip to content

Commit

Permalink
fix(glpiselectfield,dropdownfield): prevent php warning
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Oct 30, 2023
1 parent 63999d0 commit 4da93e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions inc/field/dropdownfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand All @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions inc/field/glpiselectfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand Down

0 comments on commit 4da93e3

Please sign in to comment.