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

This reverts commit 0e50cee88fe7817cd23c764f16a2b1f8feb0694f.
This commit is contained in:
Alexander Makarov
2024-06-19 21:04:17 +03:00
parent 8dacd2aad7
commit 76150c5403
3 changed files with 1 additions and 14 deletions

View File

@ -8,7 +8,6 @@ Yii Framework 2 Change Log
- Bug #16116: Codeception: oci does not support enabling/disabling integrity check (@terabytesoftw) - 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 #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) - 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 2.0.50 May 30, 2024

View File

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

View File

@ -1231,16 +1231,6 @@ EOD;
$this->assertEquals('', Html::renderTagAttributes(['class' => []])); $this->assertEquals('', Html::renderTagAttributes(['class' => []]));
$this->assertEquals(' style="width: 100px; height: 200px;"', Html::renderTagAttributes(['style' => ['width' => '100px', 'height' => '200px']])); $this->assertEquals(' style="width: 100px; height: 200px;"', Html::renderTagAttributes(['style' => ['width' => '100px', 'height' => '200px']]));
$this->assertEquals('', Html::renderTagAttributes(['style' => []])); $this->assertEquals('', Html::renderTagAttributes(['style' => []]));
$this->assertEquals(' type="submit" value="1"', Html::renderTagAttributes(['type' => 'submit', 'value' => true]));
$this->assertEquals(' type="submit" value="0"', Html::renderTagAttributes(['type' => 'submit', 'value' => false]));
$this->assertEquals(
' type="submit" value="1" disabled',
Html::renderTagAttributes(['type' => 'submit', 'value' => true, 'disabled' => true])
);
$this->assertEquals(
' type="submit" value="0"',
Html::renderTagAttributes(['type' => 'submit', 'value' => false, 'disabled' => false])
);
$attributes = [ $attributes = [
'data' => [ 'data' => [