mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-01 03:26:36 +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)
|
||||
- Enh #18904: Improve Captcha client-side validation (hexkir)
|
||||
- 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
|
||||
|
||||
@ -563,10 +563,6 @@ class Controller extends Component implements ViewContextInterface
|
||||
*/
|
||||
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.
|
||||
$typeName = $type->getName();
|
||||
if (($component = $this->module->get($name, false)) instanceof $typeName) {
|
||||
|
||||
@ -226,7 +226,12 @@ class Controller extends \yii\base\Controller
|
||||
}
|
||||
$args[] = $actionParams[$key] = $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 {
|
||||
$this->bindInjectedParams($type, $name, $args, $requestedParams);
|
||||
} catch (\yii\base\Exception $e) {
|
||||
|
||||
@ -177,7 +177,12 @@ class Controller extends \yii\base\Controller
|
||||
}
|
||||
$args[] = $actionParams[$name] = $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 {
|
||||
$this->bindInjectedParams($type, $name, $args, $requestedParams);
|
||||
} catch (HttpException $e) {
|
||||
|
||||
Reference in New Issue
Block a user