-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Behavior Change: Incorrect controller arguments no longer throw exception #20746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@weaverryan I think this is an unintended side-effect. As the method name implies, it does allow null, but this only for cases where no type-hint is given. Is this only on php7 or also on php5? edit: are 3.1 and 3.2 affected by this as well? They resolve this differently in the default setup |
Hello |
This line should probably check whether a type is set, as: |
@iltar Yep, I'm using 5.6, so it definitely is an issue there. It's tricky because now that there's been a release with the behavior change, we've sorta already accidentally broken BC. If we're going to unbreak it back, we should probably do it quickly - it's already been included in 2.7.19, 2.7.20 and 2.7.21, for example, for the 2.7 releases. @iltar are you able to make a patch that does the check you're talking about? Thanks :) |
First thing I'll do when I arrive at work
…On Sun, 4 Dec 2016, 22:04 Ryan Weaver, ***@***.***> wrote:
@iltar <https://github.com/iltar> Yep, I'm using 5.6, so it definitely is
an issue there.
It's tricky because now that there's been a release with the behavior
change, we've sorta already accidentally broken BC. If we're going to
unbreak it back, we should probably do it quickly - it's already been
included in 2.7.19, 2.7.20 and 2.7.21, for example, for the 2.7 releases.
@iltar <https://github.com/iltar> are you able to make a patch that does
the check you're talking about?
Thanks :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20746 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABrGNjyL_uKlf8aK0tAcJAXd-E0C2jQTks5rEyrOgaJpZM4LDb8V>
.
|
👍 for fixing this as a bug. |
…rguments (iltar) This PR was merged into the 2.7 branch. Discussion ---------- [2.7][HttpKernel] Regression test for missing controller arguments | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20746 | License | MIT | Doc PR | ~ This fix should ensure that when an action has a mandatory parameter without a type, it will throw the exception instead of inserting null. This test was missing when adding nullable support in 2.7 and up (probably has to be added to 3.1 as well). Commits ------- d1a7164 Regression test for missing controller arguments
…rguments (iltar) This PR was merged into the 3.1 branch. Discussion ---------- [3.1][HttpKernel] Regression test for missing controller arguments | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20746 | License | MIT | Doc PR | ~ Same fix as #20755 but for 3.1 and up as the new feature was hit by the same bug. ping @fabpot Commits ------- 9e588b8 Regression test for missing controller arguments (3.1)
Wow! That was crazy fast fix and merge - thank you @iltar! |
@weaverryan I feel responsible for changes that I contribute to and thus find it important to provide some after-care when I can |
Hi guys!
The commit sha: 9c48756 (cc @iltar) changed some behavior in all versions of Symfony, I think on accident.
Consider the following:
Previously, this would have thrown the following error:
But after this commit, it does not throw the error, and instead
$id2
is set to null in all cases. The specific problem is this block: 9c48756#diff-8518ab757bc9acd6d5a874a2e2737502R135Was this expected? It's a step back in DX, as you can now silently mess up your route param without being notified.
Cheers!
The text was updated successfully, but these errors were encountered: