-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix yii\base\Controller::bindInjectedParams() to not throw error when…
… argument of `ReflectionUnionType` type is passed (#18869)
- Loading branch information
Bizley
committed
Sep 6, 2021
1 parent
932806b
commit ea60fba
Showing
4 changed files
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ea60fba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit breaks running the action in some cases.
The removal of
&& !$type->isBuiltin()
causes the logic for parsing a the signature?int $revisionId = null
to branch here and execute$this->bindInjectedParams($type, $name, $args, $requestedParams);
The first
if
statement of that method added with this commit causes the function to return immediately for built-in types, and so the default value is never added to the$args
array.In our case, the next parameter has a signature of
?string
, so, providing that puts it in the$args
array where the?int
arg is expected to be, causing chaos.ea60fba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andris-sevcenko would you please report it as an issue? It would be definitely lost here.
ea60fba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip, @samdark