bug #17526 Escape the delimiter in Glob::toRegex (javiereguiluz)

This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #17526).

Discussion
----------

Escape the delimiter in Glob::toRegex

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13531
| License       | MIT
| Doc PR        | -

Commits
-------

2c45f46 Escape the delimiter in Glob::toRegex
This commit is contained in:
Fabien Potencier 2016-01-25 17:35:29 +01:00
commit ff4b815fdf

View File

@ -65,7 +65,7 @@ class Glob
$firstByte = true;
}
if ('.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
$regex .= "\\$car";
} elseif ('*' === $car) {
$regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');