diff --git a/framework/BaseYii.php b/framework/BaseYii.php index 1195b2349a0..156280fee5f 100644 --- a/framework/BaseYii.php +++ b/framework/BaseYii.php @@ -93,7 +93,7 @@ class BaseYii */ public static function getVersion() { - return '2.0.46-dev'; + return '2.0.46'; } /** diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index b6ddb47d7d3..6001e40bd8a 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -1,51 +1,52 @@ Yii Framework 2 Change Log ========================== -2.0.46 under development ------------------------- +2.0.46 August 18, 2022 +---------------------- -- Bug #19467: Revert changes in `Inflector::camel2words()` introduced in #19204 (samdark) -- Bug #19471: Enable console commands on hosting with disabled `exec()` function (WinterSilence, lubosdz) -- Bug #19469: Fix a virtual relation not working because of new isset checks in `\yii\db\ActiveRelationTrait` (wvanheumen) -- Bug #19380: Fix PHP 8.1 passing non string to trim() in `yii\db\Query` (wa1kb0y) -- Bug #19272: Fix bug in dirty attributes check on multidimensional array (speedplli) -- Bug #19349: Fix PHP 8.1 error when attribute and label of `yii\grid\DataColumn` are empty (githubjeka) -- Bug #19243: Handle `finfo_open` for tar.xz as `application/octet-stream` on PHP 8.1 (longthanhtran) - Bug #19235: Fix return type compatibility of `yii\web\SessionIterator` class methods for PHP 8.1 (virtual-designer) +- Bug #19237: Fix OCI PHP 8.1 passing `null` to trim() (longthanhtran) +- Bug #19243: Handle `finfo_open` for tar.xz as `application/octet-stream` on PHP 8.1 (longthanhtran) - Bug #19256: Pass missed `$view` to user's callback in `yii\validators\InlineValidator::clientValidateAttribute()` (WinterSilence) -- Enh #19270: Replace deprecated `scss` converter in `yii\web\AssetConverter::$commands` (WinterSilence) -- Enh #19254: Support specifying custom characters for `yii.validation.trim()` and replace deprecated `jQuery.trim()` (WinterSilence) +- Bug #19259: Fix `yii\log\FileTarget` locking and always rotate files only by copy (bizley, mikehaertl) +- Bug #19272: Fix bug in dirty attributes check on multidimensional array (speedplli) - Bug #19291: Reset errors and validators in `yii\base\Model::__clone()` (WinterSilence) -- Enh #19295: Add alias `text/rtf` for mime-type `application/rtf` (lesha724) -- Enh #19308: Add `yii\web\UploadedFile::$fullPath` represents 'full_path' key added in PHP 8.1 (WinterSilence) - Bug #19303: Fix serialization in `yii\caching\Dependency::generateReusableHash()` (WinterSilence) -- Enh #19304: Add filtering validator `yii\validators\TrimValidator` (WinterSilence) -- Enh #19309: Optimize `yii\base\Model::attributes()` (WinterSilence) +- Bug #19312: Fix PHP 8.1 error when passing null to `yii\helpers\BaseInflector` (WinterSilence) - Bug #19322: Revert force setting value to empty string in case it's `null` in `yii\validators\FilterValidator::validateAttribute()` (bizley) - Bug #19324: Fix `yii\helpers\BaseHtml::renderSelectOptions()` giving wrong selection for boolean attributes (adnandautovic) -- Bug #19329: Fix `yii\web\GroupUrlRule` to properly normalize prefix (bizley) - Bug #19328: Passing null to parameter #1 ($string) of type string is deprecated in `yii\db\oci\Schema` (Arkeins) -- Enh #19318: Add support for typecasting PHP 8.1 enums (EtienneBruines) -- Bug #19237: Fix OCI PHP 8.1 passing `null` to trim() (longthanhtran) -- Bug #19312: Fix PHP 8.1 error when passing null to `yii\helpers\BaseInflector` (WinterSilence) +- Bug #19329: Fix `yii\web\GroupUrlRule` to properly normalize prefix (bizley) +- Bug #19349: Fix PHP 8.1 error when attribute and label of `yii\grid\DataColumn` are empty (githubjeka) - Bug #19368: Fix PHP 8.1 error when `$fileMimeType` is `null` in `yii\validators\FileValidator::validateMimeType()` (bizley) -- Enh #19384: Normalize `setBodyParams()` and `getBodyParam()` in `yii\web\Request` (WinterSilence, albertborsos) +- Bug #19380: Fix PHP 8.1 passing non string to trim() in `yii\db\Query` (wa1kb0y) - Bug #19386: Fix recursive calling `yii\helpers\BaseArrayHelper::htmlDecode()` (WinterSilence) -- Bug #19407: Fix `yii\validators\UniqueValidator` and `yii\validators\ExistValidator` to respect `skipOnError` option for target attributes (bizley) -- Bug #19418: Fix `yii\filters\auth\CompositeAuth` ignoring `only` and `except` options (lesha724) -- Enh #19401: Delay `exit(1)` in `yii\base\ErrorHandler::handleFatalError` (arrilot) +- Bug #19400: Fix passing null in `yii\web\Response::redirect()` (bizley) - Bug #19402: Add shutdown event and fix working directory in `yii\base\ErrorHandler` (WinterSilence) -- Enh #19416: Update and improve configurations for `yii\console\controllers\MessageController` (WinterSilence) - Bug #19403: Fix types in `yii\web\SessionIterator` (WinterSilence) -- Enh #19420: Update list of JS callbacks in `yii\widgets\MaskedInput` (WinterSilence) -- Bug #19400: Fix passing null in `yii\web\Response::redirect()` (bizley) -- Enh #19437: Add support to specify request port by trusted proxies in `\yii\web\Request::getServerPort()` (rhertogh) +- Bug #19407: Fix `yii\validators\UniqueValidator` and `yii\validators\ExistValidator` to respect `skipOnError` option for target attributes (bizley) +- Bug #19418: Fix `yii\filters\auth\CompositeAuth` ignoring `only` and `except` options (lesha724) - Bug #19445: Fix caching in `yii\i18n\Formatter::getUnitMessage()` (WinterSilence) - Bug #19454: Fix PDO exception code not properly passed to `yii\db\Exception` (Roguyt) +- Bug #19462: Fix validator client options to encode HTML tags (bizley) +- Bug #19467: Revert changes in `Inflector::camel2words()` introduced in #19204 (samdark) +- Bug #19469: Fix a virtual relation not working because of new isset checks in `\yii\db\ActiveRelationTrait` (wvanheumen) +- Bug #19471: Enable console commands on hosting with disabled `exec()` function (WinterSilence, lubosdz) - Bug #19477: Cast shell_exec() output to string (schmunk42) - Bug #19481: Exception is always empty in ErrorHandler when handling fatal error (Renkas) -- Bug #19462: Fix validator client options to encode HTML tags (bizley) -- Bug #19259: Fix `yii\log\FileTarget` locking and always rotate files only by copy (bizley, mikehaertl) +- Enh #19254: Support specifying custom characters for `yii.validation.trim()` and replace deprecated `jQuery.trim()` (WinterSilence) +- Enh #19270: Replace deprecated `scss` converter in `yii\web\AssetConverter::$commands` (WinterSilence) +- Enh #19295: Add alias `text/rtf` for mime-type `application/rtf` (lesha724) +- Enh #19304: Add filtering validator `yii\validators\TrimValidator` (WinterSilence) +- Enh #19308: Add `yii\web\UploadedFile::$fullPath` represents 'full_path' key added in PHP 8.1 (WinterSilence) +- Enh #19309: Optimize `yii\base\Model::attributes()` (WinterSilence) +- Enh #19318: Add support for typecasting PHP 8.1 enums (EtienneBruines) +- Enh #19384: Normalize `setBodyParams()` and `getBodyParam()` in `yii\web\Request` (WinterSilence, albertborsos) +- Enh #19401: Delay `exit(1)` in `yii\base\ErrorHandler::handleFatalError` (arrilot) +- Enh #19416: Update and improve configurations for `yii\console\controllers\MessageController` (WinterSilence) +- Enh #19420: Update list of JS callbacks in `yii\widgets\MaskedInput` (WinterSilence) +- Enh #19437: Add support to specify request port by trusted proxies in `\yii\web\Request::getServerPort()` (rhertogh) + 2.0.45 February 11, 2022 ------------------------ diff --git a/framework/base/Application.php b/framework/base/Application.php index 380f3a2017a..e2944b82a5e 100644 --- a/framework/base/Application.php +++ b/framework/base/Application.php @@ -18,8 +18,8 @@ * @property-read \yii\rbac\ManagerInterface|null $authManager The auth manager application component or null * if it's not configured. * @property string $basePath The root directory of the application. - * @property-read \yii\caching\CacheInterface $cache The cache application component. Null if the component is - * not enabled. + * @property-read \yii\caching\CacheInterface|null $cache The cache application component. Null if the + * component is not enabled. * @property-write array $container Values given in terms of name-value pairs. * @property-read \yii\db\Connection $db The database connection. * @property-read \yii\web\ErrorHandler|\yii\console\ErrorHandler $errorHandler The error handler application diff --git a/framework/base/Model.php b/framework/base/Model.php index 774b5513eee..38031caaddb 100644 --- a/framework/base/Model.php +++ b/framework/base/Model.php @@ -46,7 +46,6 @@ * 'Username must contain only word characters.', ], 'email' => [ 'Email address is invalid.', ] ] ``` . * @property-read array $firstErrors The first errors. The array keys are the attribute names, and the array * values are the corresponding error messages. An empty array will be returned if there is no error. - * @property-read ArrayIterator $iterator An iterator for traversing the items in the list. * @property string $scenario The scenario that this model is in. Defaults to [[SCENARIO_DEFAULT]]. * @property-read ArrayObject|\yii\validators\Validator[] $validators All the validators declared in the * model. diff --git a/framework/console/Controller.php b/framework/console/Controller.php index 64ba3682508..8964d6675a9 100644 --- a/framework/console/Controller.php +++ b/framework/console/Controller.php @@ -32,8 +32,6 @@ * @property-read string $helpSummary The one-line short summary describing this controller. * @property-read array $passedOptionValues The properties corresponding to the passed options. * @property-read array $passedOptions The names of the options passed during execution. - * @property Request $request - * @property Response $response * * @author Qiang Xue * @since 2.0 diff --git a/framework/db/BaseActiveRecord.php b/framework/db/BaseActiveRecord.php index cc0de7d07f0..67a55d7884b 100644 --- a/framework/db/BaseActiveRecord.php +++ b/framework/db/BaseActiveRecord.php @@ -28,11 +28,11 @@ * @property array $oldAttributes The old attribute values (name-value pairs). Note that the type of this * property differs in getter and setter. See [[getOldAttributes()]] and [[setOldAttributes()]] for details. * @property-read mixed $oldPrimaryKey The old primary key value. An array (column name => column value) is - * returned if the primary key is composite. A string is returned otherwise (null will be returned if the key - * value is null). + * returned if the primary key is composite or `$asArray` is `true`. A string is returned otherwise (null will be + * returned if the key value is null). * @property-read mixed $primaryKey The primary key value. An array (column name => column value) is returned - * if the primary key is composite. A string is returned otherwise (null will be returned if the key value is - * null). + * if the primary key is composite or `$asArray` is `true`. A string is returned otherwise (null will be returned + * if the key value is null). * @property-read array $relatedRecords An array of related records indexed by relation names. * * @author Qiang Xue @@ -1757,7 +1757,7 @@ private function setRelationDependencies($name, $relation, $viaRelationName = nu /** * @param string $attribute - * @param mixed $value + * @param mixed $value * @return bool */ private function isAttributeDirty($attribute, $value) diff --git a/framework/db/Connection.php b/framework/db/Connection.php index fae67b054e8..0693d242206 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -110,21 +110,22 @@ * ], * ``` * - * @property string $driverName Name of the DB driver. + * @property string|null $driverName Name of the DB driver. Note that the type of this property differs in + * getter and setter. See [[getDriverName()]] and [[setDriverName()]] for details. * @property-read bool $isActive Whether the DB connection is established. * @property-read string $lastInsertID The row ID of the last row inserted, or the last value retrieved from * the sequence object. - * @property-read Connection $master The currently active master connection. `null` is returned if there is no - * master available. + * @property-read Connection|null $master The currently active master connection. `null` is returned if there + * is no master available. * @property-read PDO $masterPdo The PDO instance for the currently active master connection. * @property QueryBuilder $queryBuilder The query builder for the current DB connection. Note that the type of * this property differs in getter and setter. See [[getQueryBuilder()]] and [[setQueryBuilder()]] for details. * @property-read Schema $schema The schema information for the database opened by this connection. * @property-read string $serverVersion Server version as a string. - * @property-read Connection $slave The currently active slave connection. `null` is returned if there is no - * slave available and `$fallbackToMaster` is false. - * @property-read PDO $slavePdo The PDO instance for the currently active slave connection. `null` is returned - * if no slave connection is available and `$fallbackToMaster` is false. + * @property-read Connection|null $slave The currently active slave connection. `null` is returned if there is + * no slave available and `$fallbackToMaster` is false. + * @property-read PDO|null $slavePdo The PDO instance for the currently active slave connection. `null` is + * returned if no slave connection is available and `$fallbackToMaster` is false. * @property-read Transaction|null $transaction The currently active transaction. Null if no active * transaction. * diff --git a/framework/validators/InlineValidator.php b/framework/validators/InlineValidator.php index 595f3731c0f..800046d7081 100644 --- a/framework/validators/InlineValidator.php +++ b/framework/validators/InlineValidator.php @@ -10,7 +10,6 @@ /** * InlineValidator represents a validator which is defined as a method in the object being validated. * - * * @author Qiang Xue * @since 2.0 */ diff --git a/framework/validators/IpValidator.php b/framework/validators/IpValidator.php index 63c42fe7769..3bab5f5c3dc 100644 --- a/framework/validators/IpValidator.php +++ b/framework/validators/IpValidator.php @@ -32,9 +32,8 @@ * ['ip_address', 'ip', 'expandIPv6' => true], // expands IPv6 address to a full notation format * ``` * - * @property array $ranges The IPv4 or IPv6 ranges that are allowed or forbidden. See [[setRanges()]] for - * detailed description. Note that the type of this property differs in getter and setter. See [[getRanges()]] - * and [[setRanges()]] for details. + * @property array $ranges The IPv4 or IPv6 ranges that are allowed or forbidden. Note that the type of this + * property differs in getter and setter. See [[getRanges()]] and [[setRanges()]] for details. * * @author Dmitry Naumenko * @since 2.0.7 diff --git a/framework/validators/Validator.php b/framework/validators/Validator.php index a0677df9271..f3395fa6351 100644 --- a/framework/validators/Validator.php +++ b/framework/validators/Validator.php @@ -49,7 +49,7 @@ * For more details and usage information on Validator, see the [guide article on validators](guide:input-validation). * * @property-read array $attributeNames Attribute names. - * @property-read array $validationAttributes List of attribute names. + * @property-read array|null $validationAttributes List of attribute names. * * @author Qiang Xue * @since 2.0 diff --git a/framework/web/CompositeUrlRule.php b/framework/web/CompositeUrlRule.php index 39274e81434..30d08e18905 100644 --- a/framework/web/CompositeUrlRule.php +++ b/framework/web/CompositeUrlRule.php @@ -13,7 +13,7 @@ /** * CompositeUrlRule is the base class for URL rule classes that consist of multiple simpler rules. * - * @property-read null|int $createUrlStatus Status of the URL creation after the last [[createUrl()]] call. + * @property-read int|null $createUrlStatus Status of the URL creation after the last [[createUrl()]] call. * `null` if rule does not provide info about create status. * * @author Qiang Xue diff --git a/framework/web/Controller.php b/framework/web/Controller.php index eba2ea678da..e426584ca85 100644 --- a/framework/web/Controller.php +++ b/framework/web/Controller.php @@ -17,9 +17,6 @@ * * For more details and usage information on Controller, see the [guide article on controllers](guide:structure-controllers). * - * @property Request $request - * @property Response $response - * * @author Qiang Xue * @since 2.0 */ diff --git a/framework/web/Request.php b/framework/web/Request.php index c42b6ad8651..2c0d4eaccc6 100644 --- a/framework/web/Request.php +++ b/framework/web/Request.php @@ -37,13 +37,12 @@ * @property-read string|null $authUser The username sent via HTTP authentication, `null` if the username is * not given. * @property string $baseUrl The relative URL for the application. - * @property array|object $bodyParams The request parameters given in the request body. Note that the type of - * this property differs in getter and setter. See [[getBodyParams()]] and [[setBodyParams()]] for details. + * @property array|object $bodyParams The request parameters given in the request body. * @property-read string $contentType Request content-type. Empty string is returned if this information is * not available. * @property-read CookieCollection $cookies The cookie collection. * @property-read string $csrfToken The token used to perform CSRF validation. - * @property-read string $csrfTokenFromHeader The CSRF token sent via [[CSRF_HEADER]] by browser. Null is + * @property-read string|null $csrfTokenFromHeader The CSRF token sent via [[CSRF_HEADER]] by browser. Null is * returned if no such header is sent. * @property-read array $eTags The entity tags. * @property-read HeaderCollection $headers The header collection. @@ -77,7 +76,7 @@ * @property string $scriptFile The entry script file path. * @property string $scriptUrl The relative URL of the entry script. * @property int $securePort Port number for secure requests. - * @property-read string $serverName Server name, null if not available. + * @property-read string|null $serverName Server name, null if not available. * @property-read int|null $serverPort Server port number, null if not available. * @property string $url The currently requested relative URL. Note that the URI returned may be URL-encoded * depending on the client. diff --git a/framework/web/UploadedFile.php b/framework/web/UploadedFile.php index c5ac72f36e7..0f5a15cedd1 100644 --- a/framework/web/UploadedFile.php +++ b/framework/web/UploadedFile.php @@ -68,7 +68,6 @@ class UploadedFile extends BaseObject * @var resource|null a temporary uploaded stream resource used within PUT and PATCH request. */ private $_tempResource; - /** * @var array[] */ diff --git a/framework/web/UrlRule.php b/framework/web/UrlRule.php index 56c71d8063c..fbbf6ffe180 100644 --- a/framework/web/UrlRule.php +++ b/framework/web/UrlRule.php @@ -24,7 +24,7 @@ * ] * ``` * - * @property-read null|int $createUrlStatus Status of the URL creation after the last [[createUrl()]] call. + * @property-read int|null $createUrlStatus Status of the URL creation after the last [[createUrl()]] call. * `null` if rule does not provide info about create status. * * @author Qiang Xue diff --git a/framework/web/User.php b/framework/web/User.php index a23e6468e26..086b3c5dc63 100644 --- a/framework/web/User.php +++ b/framework/web/User.php @@ -47,7 +47,8 @@ * ] * ``` * - * @property-read string|int $id The unique identifier for the user. If `null`, it means the user is a guest. + * @property-read string|int|null $id The unique identifier for the user. If `null`, it means the user is a + * guest. * @property IdentityInterface|null $identity The identity object associated with the currently logged-in * user. `null` is returned if the user is not logged in (not authenticated). * @property-read bool $isGuest Whether the current user is a guest.