diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 6b802e17f65..561c88adc86 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -5,8 +5,10 @@ Yii Framework 2 Change Log ------------------------ - Bug #20195: Do not set non abstract values into `ColumnSchema->type` on MSSQL version less then 2017 (axeltomasson) +- 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 diff --git a/framework/data/ActiveDataProvider.php b/framework/data/ActiveDataProvider.php index 357b1eb74ef..1a098cd6474 100644 --- a/framework/data/ActiveDataProvider.php +++ b/framework/data/ActiveDataProvider.php @@ -151,8 +151,6 @@ protected function prepareKeys($models) return array_keys($models); } - private $_totalCount = []; - /** * {@inheritdoc} */ @@ -161,13 +159,8 @@ protected function prepareTotalCount() if (!$this->query instanceof QueryInterface) { throw new InvalidConfigException('The "query" property must be an instance of a class that implements the QueryInterface e.g. yii\db\Query or its subclasses.'); } - $query = (clone $this->query)->limit(-1)->offset(-1)->orderBy([]); - $key = md5((string)$query); - - if (!array_key_exists($key, $this->_totalCount)) { - $this->_totalCount[$key] = (int)$query->count('*', $this->db); - } - return $this->_totalCount[$key]; + $query = clone $this->query; + return (int) $query->limit(-1)->offset(-1)->orderBy([])->count('*', $this->db); } /** diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index ff81df22752..e69c68929a9 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -2003,8 +2003,10 @@ public static function renderTagAttributes($attributes) $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)) { diff --git a/framework/test/InitDbFixture.php b/framework/test/InitDbFixture.php index f18bd16b97a..6007b1a0ebd 100644 --- a/framework/test/InitDbFixture.php +++ b/framework/test/InitDbFixture.php @@ -95,6 +95,11 @@ public function checkIntegrity($check) if (!$this->db instanceof \yii\db\Connection) { return; } + + if ($this->db->getDriverName() === 'oci') { + return; + } + foreach ($this->schemas as $schema) { $this->db->createCommand()->checkIntegrity($check, $schema)->execute(); } diff --git a/tests/framework/helpers/HtmlTest.php b/tests/framework/helpers/HtmlTest.php index 24c8186181b..2d499031361 100644 --- a/tests/framework/helpers/HtmlTest.php +++ b/tests/framework/helpers/HtmlTest.php @@ -1231,6 +1231,16 @@ public function testRenderTagAttributes() $this->assertEquals('', Html::renderTagAttributes(['class' => []])); $this->assertEquals(' style="width: 100px; height: 200px;"', Html::renderTagAttributes(['style' => ['width' => '100px', 'height' => '200px']])); $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 = [ 'data' => [