Skip to content

Commit 76150c5

Browse files
committed
Revert "Fix #20198: Boolean values of the value HTML attribute are now converted to integer values"
This reverts commit 0e50cee.
1 parent 8dacd2a commit 76150c5

File tree

3 files changed

+1
-14
lines changed

3 files changed

+1
-14
lines changed

Diff for: framework/CHANGELOG.md

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

1312

1413
2.0.50 May 30, 2024

Diff for: framework/helpers/BaseHtml.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -2003,10 +2003,8 @@ public static function renderTagAttributes($attributes)
20032003
$html = '';
20042004
foreach ($attributes as $name => $value) {
20052005
if (is_bool($value)) {
2006-
if ($value && 'value' !== $name) {
2006+
if ($value) {
20072007
$html .= " $name";
2008-
} elseif ('value' === $name) {
2009-
$html .= " $name=\"" . static::encode((int)$value) . '"';
20102008
}
20112009
} elseif (is_array($value)) {
20122010
if (in_array($name, static::$dataAttributes)) {

Diff for: tests/framework/helpers/HtmlTest.php

-10
Original file line numberDiff line numberDiff line change
@@ -1231,16 +1231,6 @@ public function testRenderTagAttributes()
12311231
$this->assertEquals('', Html::renderTagAttributes(['class' => []]));
12321232
$this->assertEquals(' style="width: 100px; height: 200px;"', Html::renderTagAttributes(['style' => ['width' => '100px', 'height' => '200px']]));
12331233
$this->assertEquals('', Html::renderTagAttributes(['style' => []]));
1234-
$this->assertEquals(' type="submit" value="1"', Html::renderTagAttributes(['type' => 'submit', 'value' => true]));
1235-
$this->assertEquals(' type="submit" value="0"', Html::renderTagAttributes(['type' => 'submit', 'value' => false]));
1236-
$this->assertEquals(
1237-
' type="submit" value="1" disabled',
1238-
Html::renderTagAttributes(['type' => 'submit', 'value' => true, 'disabled' => true])
1239-
);
1240-
$this->assertEquals(
1241-
' type="submit" value="0"',
1242-
Html::renderTagAttributes(['type' => 'submit', 'value' => false, 'disabled' => false])
1243-
);
12441234

12451235
$attributes = [
12461236
'data' => [

0 commit comments

Comments
 (0)