mirror of
https://github.com/processwire/processwire.git
synced 2025-08-15 03:05:26 +02:00
Fix issue processwire/processwire-issues#2041
This commit is contained in:
@@ -1275,6 +1275,15 @@ class WireHooks {
|
||||
$regexDelim = $matchPath[0];
|
||||
} else {
|
||||
// needs to be in regex format
|
||||
if(strpos($matchPath, '.') !== false) {
|
||||
// preserve some regex sequences containing periods
|
||||
$r = [ '.+' => '•+', '.*' => '•*', '\\.' => '\\•' ];
|
||||
$matchPath = str_replace(array_keys($r), array_values($r), $matchPath);
|
||||
// force any remaining periods to be taken literally
|
||||
$matchPath = str_replace('.', '\\.', $matchPath);
|
||||
// restore regex sequences containing periods
|
||||
$matchPath = str_replace(array_values($r), array_keys($r), $matchPath);
|
||||
}
|
||||
if(strpos($matchPath, '/') === 0) $matchPath = "^$matchPath";
|
||||
$matchPath = "#$matchPath$#";
|
||||
}
|
||||
|
Reference in New Issue
Block a user