From 89600b232776d7afeef78e921320e17b1b7238b9 Mon Sep 17 00:00:00 2001 From: cristiangirlea Date: Thu, 17 Aug 2023 10:16:22 +0300 Subject: [PATCH] Update BaseHtml.php --- framework/helpers/BaseHtml.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index 9fbdf6e8ba6..a134d27bd50 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -1930,13 +1930,12 @@ public static function renderSelectOptions($selection, $items, &$tagOptions = [] if ($selection !== null) { if (ArrayHelper::isTraversable($selection)) { $selected = ArrayHelper::isIn((string)$key, $selection, $strict); + } elseif (is_object($selection) && property_exists($selection, 'value')) { + $selected = $selection->value == $key; } elseif ($key === '' || $selection === '') { $selected = $selection === $key; - } elseif ($strict) { - $selected = !strcmp((string)$key, (string)$selection); } else { - $selected = is_object($selection) && property_exists($selection, 'value') ? - $selection->value == $key : $selection == $key; + $selected = $strict ? !strcmp((string)$key, (string)$selection) : $selection == $key; } }