Skip to content

[Routing] Use the PCRE_DOLLAR_ENDONLY modifier in route regexes #26035

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

nicolas-grekas
Copy link
Member

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

A "seamlesser" alternative to #25373, ping @mpdude

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Feb 3, 2018
@nicolas-grekas nicolas-grekas changed the title Use the PCRE_DOLLAR_ENDONLY modifier in route regexes [Routing] Use the PCRE_DOLLAR_ENDONLY modifier in route regexes Feb 3, 2018
@mpdude
Copy link
Contributor

mpdude commented Feb 3, 2018

Ouch 😢.

I really don't know how to answer this. I appreciate your constructive approach by providing a different approach for #25373. And I really love Symfony! So, if that's the fix for the issue I reported, I'd like to withdraw the bug report 🤕 .

Joking aside: What I don't like about this is that it keeps the (IMO "wrong") regex provided by $compiledRoute->getRegex() as-is to prevent us from twiddling with tests. But then it sneaks in the missing PCRE_DOLLAR_ENDONLY in the right places so the change takes effect?

@nicolas-grekas
Copy link
Member Author

Don't be sad, you're still the commit author.
The less we need to change tests, the less we potentially break BC.
This fixes the issue totally in practice (your test case is still here.)

@mpdude
Copy link
Contributor

mpdude commented Feb 3, 2018

Yes, I agree that this probably fixes the issue. And commit authorship is not what I am after ;-)

What I wanted to say is that I love Symfony because of its clean architecture, being mostly free of quirks and ugly fixes. And this change adds the D modifier outside the getRegex method in those places where it matters functionally for the underlying issue, without affecting/breaking/having to change tests that only look at the getRegex return value.

To me, this seems wrong from the software architecture point view :-(.

@nicolas-grekas
Copy link
Member Author

I don't have the same pov: a Route is a data object, so changing its data description to fix an interpretation issue might not be better. On the architectural pov, nothing changes: the design is exactly the same, interfaces wise. The benefit of this approach is eg that serialized routes will get the fixed behavior too.

@nicolas-grekas nicolas-grekas deleted the fix-url-with-trailing-encoded-newline branch February 4, 2018 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants