mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 04:37:42 +08:00
Fix #18909: Fix bug with binding default action parameters for controllers
This commit is contained in:
@ -23,6 +23,7 @@ Yii Framework 2 Change Log
|
|||||||
- Bug #18898: Fix `yii\helpers\Inflector::camel2words()` to work with words ending with 0 (michaelarnauts)
|
- Bug #18898: Fix `yii\helpers\Inflector::camel2words()` to work with words ending with 0 (michaelarnauts)
|
||||||
- Enh #18904: Improve Captcha client-side validation (hexkir)
|
- Enh #18904: Improve Captcha client-side validation (hexkir)
|
||||||
- Bug #18913: Add filename validation for `MessageSource::getMessageFilePath()` (uaoleg)
|
- Bug #18913: Add filename validation for `MessageSource::getMessageFilePath()` (uaoleg)
|
||||||
|
- Bug #18909: Fix bug with binding default action parameters for controllers (bizley)
|
||||||
|
|
||||||
|
|
||||||
2.0.43 August 09, 2021
|
2.0.43 August 09, 2021
|
||||||
|
|||||||
@ -563,10 +563,6 @@ class Controller extends Component implements ViewContextInterface
|
|||||||
*/
|
*/
|
||||||
final protected function bindInjectedParams(\ReflectionType $type, $name, &$args, &$requestedParams)
|
final protected function bindInjectedParams(\ReflectionType $type, $name, &$args, &$requestedParams)
|
||||||
{
|
{
|
||||||
if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since it is not a builtin type it must be DI injection.
|
// Since it is not a builtin type it must be DI injection.
|
||||||
$typeName = $type->getName();
|
$typeName = $type->getName();
|
||||||
if (($component = $this->module->get($name, false)) instanceof $typeName) {
|
if (($component = $this->module->get($name, false)) instanceof $typeName) {
|
||||||
|
|||||||
@ -226,7 +226,12 @@ class Controller extends \yii\base\Controller
|
|||||||
}
|
}
|
||||||
$args[] = $actionParams[$key] = $params[$key];
|
$args[] = $actionParams[$key] = $params[$key];
|
||||||
unset($params[$key]);
|
unset($params[$key]);
|
||||||
} elseif (PHP_VERSION_ID >= 70100 && ($type = $param->getType()) !== null) {
|
} elseif (
|
||||||
|
PHP_VERSION_ID >= 70100
|
||||||
|
&& ($type = $param->getType()) !== null
|
||||||
|
&& $type instanceof \ReflectionNamedType
|
||||||
|
&& !$type->isBuiltin()
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
$this->bindInjectedParams($type, $name, $args, $requestedParams);
|
$this->bindInjectedParams($type, $name, $args, $requestedParams);
|
||||||
} catch (\yii\base\Exception $e) {
|
} catch (\yii\base\Exception $e) {
|
||||||
|
|||||||
@ -177,7 +177,12 @@ class Controller extends \yii\base\Controller
|
|||||||
}
|
}
|
||||||
$args[] = $actionParams[$name] = $params[$name];
|
$args[] = $actionParams[$name] = $params[$name];
|
||||||
unset($params[$name]);
|
unset($params[$name]);
|
||||||
} elseif (PHP_VERSION_ID >= 70100 && ($type = $param->getType()) !== null) {
|
} elseif (
|
||||||
|
PHP_VERSION_ID >= 70100
|
||||||
|
&& ($type = $param->getType()) !== null
|
||||||
|
&& $type instanceof \ReflectionNamedType
|
||||||
|
&& !$type->isBuiltin()
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
$this->bindInjectedParams($type, $name, $args, $requestedParams);
|
$this->bindInjectedParams($type, $name, $args, $requestedParams);
|
||||||
} catch (HttpException $e) {
|
} catch (HttpException $e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user