diff --git a/.travis.yml b/.travis.yml index ff61055999..a5d80f3f5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -198,7 +198,7 @@ before_script: # Disable DEPRECATE messages during PHPUnit initialization on PHP 7.2. To fix them, PHPUnit should be updated to 6.* # For Yii2 tests, messages will be enabled by tests/bootstrap.php - | - if [[ $TRAVIS_PHP_VERSION == 7.2 || $TRAVIS_PHP_VERSION == 7.3 || $TRAVIS_PHP_VERSION == 7.4snapshot || $TRAVIS_PHP_VERSION = nightly ]]; then + if [[ $TRAVIS_PHP_VERSION == 7.2 || $TRAVIS_PHP_VERSION == 7.3 || $TRAVIS_PHP_VERSION == 7.4 || $TRAVIS_PHP_VERSION = nightly ]]; then echo 'Disabled DEPRECATED notifications for PHP >= 7.2'; echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> /tmp/php-config.ini; phpenv config-add /tmp/php-config.ini; diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 608014a585..56f267cfc9 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -7,7 +7,9 @@ Yii Framework 2 Change Log - Bug #17685: Fix invalid db component in `m180523_151638_rbac_updates_indexes_without_prefix` (rvkulikov) - Bug #17694: Fixed Error Handler to clear registered view tags, scripts, and files when rendering error view through action view (bizley) - Bug #17701: Throw `BadRequetHttpException` when request params can’t be bound to `int` and `float` controller action arguments (brandonkelly) - +- Bug #17723: Fix `Model::activeAttributes()` to access array offset on value of non-string (samdark) +- Bug #17723: Fix incorrect decoding of default binary value for PostgreSQL (samdark) +- Bug #17723: Fix incorrect type-casting of reflection type to string (samdark) 2.0.30 November 19, 2019 ------------------------ diff --git a/framework/base/Model.php b/framework/base/Model.php index 9dc9417f38..9080625c1b 100644 --- a/framework/base/Model.php +++ b/framework/base/Model.php @@ -819,7 +819,7 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg } $attributes = array_keys(array_flip($scenarios[$scenario])); foreach ($attributes as $i => $attribute) { - if ($attribute[0] === '!') { + if (strncmp($attribute, '!', 1) === 0) { $attributes[$i] = substr($attribute, 1); } } diff --git a/framework/db/pgsql/Schema.php b/framework/db/pgsql/Schema.php index 710d89a7d2..938cff6a34 100644 --- a/framework/db/pgsql/Schema.php +++ b/framework/db/pgsql/Schema.php @@ -552,6 +552,8 @@ SQL; $column->defaultValue = new Expression($column->defaultValue); } elseif ($column->type === 'boolean') { $column->defaultValue = ($column->defaultValue === 'true'); + } elseif (preg_match("/^B'(.*?)'::/", $column->defaultValue, $matches)) { + $column->defaultValue = bindec($matches[1]); } elseif (strncasecmp($column->dbType, 'bit', 3) === 0 || strncasecmp($column->dbType, 'varbit', 6) === 0) { $column->defaultValue = bindec(trim($column->defaultValue, 'B\'')); } elseif (preg_match("/^'(.*?)'::/", $column->defaultValue, $matches)) { diff --git a/framework/web/Controller.php b/framework/web/Controller.php index 9ee3a982bf..b60c3f4e7f 100644 --- a/framework/web/Controller.php +++ b/framework/web/Controller.php @@ -139,7 +139,8 @@ class Controller extends \yii\base\Controller $type->isBuiltin() && ($params[$name] !== null || !$type->allowsNull()) ) { - switch ((string)$type) { + $typeName = PHP_VERSION_ID >= 70100 ? $type->getName() : (string)$type; + switch ($typeName) { case 'int': $params[$name] = filter_var($params[$name], FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); break;