Fix #20198: Boolean values of the value HTML attribute are now converted to integer values

This commit is contained in:
Evgeniy Moiseenko
2024-06-17 18:57:37 +03:00
committed by GitHub
parent 140570d186
commit 0e50cee88f
3 changed files with 14 additions and 1 deletions

View File

@ -7,6 +7,7 @@ Yii Framework 2 Change Log
- Bug #16116: Codeception: oci does not support enabling/disabling integrity check (@terabytesoftw)
- Bug #20191: Fix `ActiveRecord::getDirtyAttributes()` for JSON columns with multi-dimensional array values (brandonkelly)
- Bug #20175: Fix bad result for pagination when used with GridView (@lav45)
- Enh #20198: Boolean values of the `value` HTML attribute are now converted to integer values (@s1lver)
2.0.50 May 30, 2024

View File

@ -2003,8 +2003,10 @@ class BaseHtml
$html = '';
foreach ($attributes as $name => $value) {
if (is_bool($value)) {
if ($value) {
if ($value && 'value' !== $name) {
$html .= " $name";
} elseif ('value' === $name) {
$html .= " $name=\"" . static::encode((int)$value) . '"';
}
} elseif (is_array($value)) {
if (in_array($name, static::$dataAttributes)) {