Skip to content
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

[5.1] Quote user-supplied content for use in preg_match #13059

Merged
merged 4 commits into from
Apr 8, 2016
Merged

[5.1] Quote user-supplied content for use in preg_match #13059

merged 4 commits into from
Apr 8, 2016

Conversation

vlakoff
Copy link
Contributor

@vlakoff vlakoff commented Apr 7, 2016

Follow-up to #13039.

Escaping for use in regex as it should be.

Removed the error suppression as it shouldn't be needed now.
It was just a "poor man fix", and there is no @preg_* elsewhere in the code.

@GrahamCampbell
Copy link
Member

This is not really correct. If quoting is needed, then the input is already invalid...

@vlakoff
Copy link
Contributor Author

vlakoff commented Apr 7, 2016

  • For example the dot in "application/vnd.ms-excel" is interpreted as a meta character. Doesn't change anything in practice, but just to show it's wrong. Not the first time I see this.
  • Currently someone could pass expensive regexes. Needless to say, this hurts.

@GrahamCampbell
Copy link
Member

Good point. 👍, but I'd say just do the quoting inline. Don't write to the array again.

@GrahamCampbell
Copy link
Member

Please add a test case which failed before and passes now.

@vlakoff
Copy link
Contributor Author

vlakoff commented Apr 7, 2016

  • Personally I prefer the quoting as it is, rather than inlining it.
  • Added dedicated tests.

@taylorotwell taylorotwell merged commit dcef6c5 into laravel:5.1 Apr 8, 2016
@vlakoff vlakoff deleted the request-type branch April 8, 2016 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants