From a945e9856d26b971a52f80115990337728c5effa Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 3 Apr 2024 13:07:19 +0200 Subject: [PATCH] Fix error in user search `$value` can be `null`, which leads to subsequent errors. --- .../install/files/lib/system/option/FloatOptionType.class.php | 2 +- .../install/files/lib/system/option/TextOptionType.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/option/FloatOptionType.class.php b/wcfsetup/install/files/lib/system/option/FloatOptionType.class.php index b50d3dcf6f..967f29d361 100644 --- a/wcfsetup/install/files/lib/system/option/FloatOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/FloatOptionType.class.php @@ -60,7 +60,7 @@ class FloatOptionType extends TextOptionType return false; } - $value = StringUtil::trim($value); + $value = StringUtil::trim($value ?: '0'); $value = $this->toFloat($value); $conditions->add("option_value.userOption" . $option->optionID . " LIKE ?", [$value]); diff --git a/wcfsetup/install/files/lib/system/option/TextOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextOptionType.class.php index 6a49c0a029..9bd767bff5 100644 --- a/wcfsetup/install/files/lib/system/option/TextOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextOptionType.class.php @@ -77,7 +77,7 @@ class TextOptionType extends AbstractOptionType implements ISearchableConditionU return false; } - $value = StringUtil::trim($value); + $value = StringUtil::trim($value ?: ''); if ($value == '') { $conditions->add("option_value.userOption" . $option->optionID . " = ?", ['']); } else { -- 2.20.1