Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Router] added \Z as regex end for route requirement#37714
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedAug 1, 2020
This looks like unneeded precaution to me. New lines are not legit in URLs. |
| if ('$' ===substr($regex, -1)) { | ||
| $regex =substr($regex,0, -1); | ||
| }elseif (\strlen($regex) -2 ===strpos($regex,'\\z')) { |
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.
Unrelated to the PR: couldn't this be written as this?} elseif (false !== strpos($regex, '\\z', -2)) {
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.
@nicolas-grekas triedstrpos andstrrpos:
strpos(): Offset not contained in string in .... (strpos doesn't accept negative offset)strrpos(): Offset is greater than the length of haystack string
In previous PR (#37711) I added
/Aand/z, but$in regex is/z+/Z.Thanks@rvitaliy:#37711 (comment)
References:
^ and $:https://www.pcre.org/original/doc/html/pcrepattern.html#TOC1
\A, \z, \Z:https://www.pcre.org/original/doc/html/pcrepattern.html#SEC5