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 c5e3077 commit d13d108
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 @@ -594,7 +594,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 @@ -616,7 +616,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 @@ -635,7 +635,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 d13d108

Please sign in to comment.