-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Fix BC break in AnnotationClassLoader defaults attributes handling #21379
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
Conversation
We could still deprecate this feature in 3.3 as it's inconsistent with other loaders, properly defining attributes is always better IMHO. |
Can you add a test-case with the What to do about the feature regarding defaults?
|
IMHO it should be removed, at least not kept as is, switching between two config formats for routing should not break an app.
Sure! |
Removing it makes sense, but it must be done using a deprecation first (so deprecated in 3.3 and removed in 4.0) |
33e78ce
to
de10ea6
Compare
Functional test added. Hope the fix is good, it was not that easy 😄 Status: needs review |
Not sure we should deprecate the feature, I think it's a nice one. |
I can understand. I'll look at adding it to other formats on 3.3 if you agree |
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
class AnnotatedController extends ContainerAware |
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.
It doesn't need the container.
de10ea6
to
e3eb006
Compare
e3eb006
to
1d298f0
Compare
Build failure is normal (high deps only). |
Thank you @chalasr. |
… attributes handling (chalasr) This PR was merged into the 2.7 branch. Discussion ---------- [Routing] Fix BC break in AnnotationClassLoader defaults attributes handling | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | 77289b9#commitcomment-20572462 | License | MIT | Doc PR | n/a This fixes a BC break introduced in #21333. Instead of removing the automatic request attributes creation, we keep it but only for attributes that are mandatory (i.e. present in the route path). Thanks to @iltar for the idea. Commits ------- 1d298f0 [Routing] Fix BC break in AnnotationClassLoader defaults attributes handling
This is still a BC break as demonstrated by the tests of FrameworkExtraBundle: https://travis-ci.org/sensiolabs/SensioFrameworkExtraBundle/jobs/197153674 @chalasr Can you have a look at this? |
/**
* @Route("/simple/multiple/{a}/{b}/")
* @Template("@Foo/Simple/some.html.twig")
*/
public function someMoreAction($a, $b, $c = 'c')
{
} expectation is |
I'll look into it. |
Reproduced on our test case in 2.7 and 3.3 (master...chalasr:reproduce-sensioextra-test) all is fine for argument resolving. The bottleneck seems to be in the |
This PR was merged into the 3.0 branch. Discussion ---------- Fix default vars resolution for Template annotation Fixes broken `@Template` default vars resolution which was relying on a buggy behavior fixed symfony/symfony#21379 (the annotation class loader no longer sets request attributes for any argument that has a default value, but only for ones which may be expected in the route path). Commits ------- 9ddf58a Fix default vars resolution for Template annotation
This fixes a BC break introduced in #21333. Instead of removing the automatic request attributes creation, we keep it but only for attributes that are mandatory (i.e. present in the route path).
Thanks to @iltar for the idea.