Merge branch 'master' into feature/attach-behaviors-with-closure

# Conflicts:
#	framework/base/Component.php
#	tests/framework/base/ComponentTest.php
This commit is contained in:
Tim Kelty
2024-09-23 09:39:26 -04:00
10 changed files with 56 additions and 26 deletions

View File

@ -7,6 +7,7 @@ Yii Framework 2 Change Log
- Bug #20232: Fix regression introduced in `GHSA-cjcc-p67m-7qxm` while attaching behavior defined by `__class` array key (erickskrauch)
- Bug #20231: Fix regression introduced in #20167 in `yii\validators\FileValidator` (bizley)
- Enh #20247: Support for variadic console controller action methods (brandonkelly)
- Bug #20256: Add support for dropping views in MSSQL server when running migrate/fresh (ambrozt)
2.0.51 July 18, 2024
--------------------

View File

@ -192,7 +192,9 @@ class Component extends BaseObject
$this->attachBehavior($name, $value);
} elseif ($value instanceof \Closure) {
$this->attachBehavior($name, call_user_func($value));
} elseif ((isset($value['class']) && is_subclass_of($value['class'], Behavior::class)) || (isset($value['__class']) && is_subclass_of($value['__class'], Behavior::class))) {
} elseif (isset($value['__class']) && is_subclass_of($value['__class'], Behavior::class)) {
$this->attachBehavior($name, Yii::createObject($value));
} elseif (!isset($value['__class']) && isset($value['class']) && is_subclass_of($value['class'], Behavior::class)) {
$this->attachBehavior($name, Yii::createObject($value));
} elseif (is_string($value) && is_subclass_of($value, Behavior::class, true)) {
$this->attachBehavior($name, Yii::createObject($value));

View File

@ -333,6 +333,7 @@ class MigrateController extends BaseMigrateController
$dropViewErrors = [
'DROP VIEW to delete view', // SQLite
'SQLSTATE[42S02]', // MySQL
'is a view. Use DROP VIEW', // Microsoft SQL Server
];
foreach ($dropViewErrors as $dropViewError) {

View File

@ -24,7 +24,7 @@
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
' and ' => '',
' and ' => '',
'"{attribute}" does not support operator "{operator}".' => '',
'(not set)' => '(未設定)',
'Action not found.' => '',
@ -51,7 +51,7 @@ return [
'Please fix the following errors:' => '請修正以下錯誤:',
'Please upload a file.' => '請上傳一個檔案。',
'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.' => '第 <b>{begin, number}-{end, number}</b> 項,共 <b>{totalCount, number}</b> 項資料.',
'The combination {values} of {attributes} has already been taken.' => '',
'The combination {values} of {attributes} has already been taken.' => '{attribute} 的值 "{value}" 已經被佔用了。',
'The file "{file}" is not an image.' => '檔案 "{file}" 不是一個圖片檔案。',
'The file "{file}" is too big. Its size cannot exceed {formattedLimit}.' => '檔案"{file}"太大了。它的大小不可以超過{formattedLimit}。',
'The file "{file}" is too small. Its size cannot be smaller than {formattedLimit}.' => '文件"{file}"太小了。它的大小不可以小於{formattedLimit}。',