#30438 closed defect (bug) (fixed)
Home path can't contain regular expression special chars
Reported by: | akirk | Owned by: | ocean90 |
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | minor | Version: | 2.0 |
Component: | Rewrite Rules | Keywords: | has-patch |
Focuses: | Cc: |
Description
Because $home_path
is used within a preg_replace
without being run through preg_quote
if, for example, it contains a +
then it won't get stripped properly and therefore no path on the site will work.
Attachments (8)
Change History (18)
#3
@
10 years ago
- Keywords needs-unit-tests added
Thanks. It'd be good to have a unit test here too.
#4
@
10 years ago
I have added 2 unit tests in rewrite.php
. Maybe you'd wish to put merge them into one function and use a foreach
loop to avoid code duplication.
This ticket was mentioned in Slack in #core by akirk. View the logs.
9 years ago
Note: See
TracTickets for help on using
tickets.
Small explanation for my patch: the
preg_quote
could be applied at the variable definition but for code review reasons I'd suggest to make it obvious in thepreg_replace
that the variable used in the regular expression is quoted properly.