Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Routing] fix matching host patterns, utf8 prefixes and non-capturing groups#27511

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.1fromnicolas-grekas:route-fix-host
Jun 10, 2018

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedJun 6, 2018
edited
Loading

QA
Branch?4.1
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#27448,#27461,#27504,#27512
LicenseMIT
Doc PR-

@rmsint
Copy link

rmsint commentedJun 6, 2018
edited
Loading

I ran into thepreg_match(): Compilation failed: ... unmatched parentheses ... error and tried this fix. I could narrow it down to a utf8 route:

/** * @Route( *     "/file/{filename}", *     name = "file_download", *     requirements = { "filename": ".+" }, *     options = { "utf8": true } * ) * @Method("GET") */publicfunctiondownload($filename,LocalFileSystem$localFileSystem){// ..}

Similar ashttps://symfony.com/blog/new-in-symfony-3-2-unicode-routing-support

As soon as I remove theoptions = { "utf8": true } from the route my tests pass again and the route matcher does not throw thepreg_match(): ... unmatched parentheses anymore.

@nicolas-grekas
Copy link
MemberAuthor

@rmsint see#27504, that's the issue you're experiencing. I'll add a fix for it here soon.

@rmsint
Copy link

@nicolas-grekas yes exactly, I noticed you pointed there to this fix. Thanks!

@nicolas-grekasnicolas-grekasforce-pushed theroute-fix-host branch 2 times, most recently fromb01e533 to36e4f29CompareJune 6, 2018 16:25
@nicolas-grekas
Copy link
MemberAuthor

PR is ready, sorry about the huge diff, its fixtures...

}
}
restore_error_handler();
if ($i <$end &&0b10 === (\ord($prefix[$i]) >>6) &&preg_match('//u',$prefix.''.$anotherPrefix)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would add a comment here explaining what that snippet of code do.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

comment added

@nicolas-grekas
Copy link
MemberAuthor

Status: needs review

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit465b15c intosymfony:4.1Jun 10, 2018
fabpot added a commit that referenced this pull requestJun 10, 2018
…n-capturing groups (nicolas-grekas)This PR was merged into the 4.1 branch.Discussion----------[Routing] fix matching host patterns, utf8 prefixes and non-capturing groups| Q             | A| ------------- | ---| Branch?       | 4.1| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#27448,#27461,#27504,#27512| License       | MIT| Doc PR        | -Commits-------465b15c [Routing] fix matching host patterns, utf8 prefixes and non-capturing groups
@nicolas-grekasnicolas-grekas deleted the route-fix-host branchJune 10, 2018 19:14
@teohhanhui
Copy link
Contributor

@stof
Copy link
Member

@teohhanhui we are already parsing routes properly, and compiling them to a regex each (which is what this route-parser is doing) is battle-tested in symfony since many years.

the hard thing here is that Symfony 4.1 is now generating only a few regexes combining routes together to make matching much faster. And the new logic is not yet as battle-tested for all edge-cases (and the fact that we combine routes creates much more weird cases than when matching them separately, as we need to think about how the cases interact together).
The route-parser you linked too will match a single route, not a full collection of routes to find the matching one.

@teohhanhui
Copy link
Contributor

teohhanhui commentedJun 19, 2018
edited
Loading

Sorry, I must have misunderstood. Because I cannot find any parser in the Symfony Routing component:
https://github.com/symfony/routing/search?q=parse&unscoped_q=parse

like I could in Twig:
https://github.com/twigphp/Twig/search?q=parse&unscoped_q=parse

or the Symfony ExpressionLanguage component:
https://github.com/symfony/expression-language/search?q=parse&unscoped_q=parse

@fabpotfabpot mentioned this pull requestJun 25, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@rmsint@fabpot@teohhanhui@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp