Skip to content

Commit d11ee00

Browse files
authored
Update FormBuilder.php
fix options have 0 and null or empty in_array(0, [null]) in_array(0, ['']) in_array(0, ['0']) they are true in_array('0', ['0']) => true in_array('0', [null]) => false in_array('0', ['']) => false
1 parent a90c5ad commit d11ee00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/FormBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private function renderSelect(): string
146146
$arrValues = is_array($fieldValue) ? $fieldValue : [$fieldValue];
147147
$optionsList = '';
148148
foreach ($options as $value => $label) {
149-
$attrs = $this->buildHtmlAttrs(['value' => $value, 'selected' => in_array($value, $arrValues)], false);
149+
$attrs = $this->buildHtmlAttrs(['value' => $value, 'selected' => in_array(strval($value), $arrValues)], false);
150150
$optionsList .= '<option ' . $attrs . '>' . $label . '</option>';
151151
}
152152

0 commit comments

Comments
 (0)