-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing][DX] Deprecated bundle:controller:action Syntax Is Only Triggered on First Request #27387
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
Can you elaborate?
It happens when the container is built, not on the first request. |
Actually, it happens during cache warmup, which makes things harder to spot. |
the issue for that is that the cache warming is optimizing the router by resolving this notation to the class name during cache warmup. So when performing the matching itself in the request, the deprecation notation is not used. |
@Tobion As stof said it's very hard to spot these messages and they are very useful. Also our code contains a lot of internal deprecations, so it's hard to expect from developers to pay attention to a message which only appears once. @stof I looked into the code and indeed it replaces My point is that any problem reported during compilation of container are persisted in profiler while problems with routes aren't. I showed this to few developers in the team and they were surprised such deprecation exists since they never seen it (in fact I myself found it not via profiler but while checking changelogs). |
well, we would need a way to report cache warmup errors later, similar to what has been done for the container builder. That's something we can put on the roadmap for 4.2. |
This PR was merged into the 4.2-dev branch. Discussion ---------- CacheWarmerAggregate handle deprecations logs | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #27387 | License | MIT Actually the Web Debug Toolbar warning you about the deprecation messages thrown during the container built (#21502). Cache warmup can throw deprecated message without any persistance, it may cause issue like #27387 This PR reproduce the same job for the cache warmer, and so on, handle deprecated messages during the warmup of Twig, Translator, Validator, Security and all `kernel.cache_warmer` services. Here are the point that may be improvable in this PR: 1. Actually I've "duplicate" the callable used in the `set_error_handler` of the Kernel. IMHO I think that Kernel and CacheWarmerAggregate have differents jobs and a trait may be a good solution to share this error handler setter without duplicating the code, but I'm a little bit lost about the repercussion of adding a Trait in the Kernel. 2. I've think about extending the `CacheWarmerAggregate` into a `DeprecatedLogHandlingCacheWarmerAggregate` to add the debug and containerClass argument, and declare it as the `cache_warmer` service only in debug mode (by declaring it in the DebugBundle/Resources/config/services.xml). Commits ------- f03b8bb CacheWarmerAggregate handle deprecations logs
Description
In my large project I still have routes defined as
bundle:controller:action
, which is deprecated since #25910. @Tobion did a great job on that PR, but the deprecation message has very poor DX.PR for that issue mentions that deprecation message is displayed only during first request (which may be e.g. redirect) and is hard to spot. I believe the message should be displayed every time route is matched.
WDYT?
The text was updated successfully, but these errors were encountered: