#30438 closed defect (bug) (fixed)
Home path can't contain regular expression special chars
| Reported by: | akirk | Owned by: | ocean90 |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.3 |
| Component: | Rewrite Rules | Version: | 2.0 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
12 years ago
- Keywords needs-unit-tests added
Thanks. It'd be good to have a unit test here too.
#4
@
12 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.
11 years ago
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Small explanation for my patch: the
preg_quotecould be applied at the variable definition but for code review reasons I'd suggest to make it obvious in thepreg_replacethat the variable used in the regular expression is quoted properly.