-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] [WebProfileBundle] Fix Routing panel for URLs with a colon #57917
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
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
b4237c4
to
9c3d8ce
Compare
I took another look. Instead of reparsing the relative path info, we can simply call the |
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.
The change itself looks good to me. But I have some remarks for the test.
src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/RouterControllerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/RouterControllerTest.php
Outdated
Show resolved
Hide resolved
dcc006a
to
392570e
Compare
cc @alexandre-daubois as you worked on the URI component |
392570e
to
079c8df
Compare
Thank you @akeylimepie. |
Oh my god, this is amazing, thank you! |
According to docs the
parse_url
function may not produce the expected result for relative URLs. In particular, the function produces incorrect results for a relative URL with a port-like string in any part, such as:But such a URL is valid. So if there is a controller with this route for it, Symfony will correctly match it:
Bug
But in the profiler, opening the Routing panel will not work; instead of the panel, we see an exception:
This is because
Symfony\Bundle\WebProfilerBundle\Controller::getTraces
method creates a newRequest
from relative path info. AndRequest::create
since 6.3 #49376 throws an exception ifparse_url
returnsfalse
, which is the case here:symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php
Line 83 in 6d6dd4a
Prior to version 6.3, the routing panel is displayed, but there are no router matches on it. This is why version 5.4 is also affected.
Solution
So instead of a relative path, I suggest using an absolute URI, which is handled by
parse_url
correctly: