Skip to content

Commit 99c0797

Browse files
committed
Update to “Controller Filters ”
URI multi-level directory will be prompted wrong. err mes : preg_match(): Unknown modifier 'r' show demo: application/Config/Filters.php public filters = [ 'foo' => ['before' => ['admin/foo/*']], 'bar' => ['before' => ['admin/bar/*']] ]; If the delimiter appears often inside the pattern, it is a good idea to choose another delimiter in order to increase readability. http://php.net/manual/en/regexp.reference.delimiters.php
1 parent a6fd7a1 commit 99c0797

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

system/Filters/Filters.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ protected function processGlobals(string $uri = null)
244244
$path = trim(str_replace('*', '.+', $path), '/ ');
245245

246246
// Path doesn't match the URI? continue on...
247-
if (preg_match('/' . $path . '/', $uri, $match) !== 1)
247+
if (preg_match('#' . $path . '#', $uri, $match) !== 1)
248248
{
249249
continue;
250250
}
@@ -282,7 +282,7 @@ protected function processGlobals(string $uri = null)
282282
$path = trim(str_replace('*', '.+', $path), '/ ');
283283

284284
// Path doesn't match the URI? continue on...
285-
if (preg_match('/' . $path . '/', $uri, $match) !== 1)
285+
if (preg_match('#' . $path . '#', $uri, $match) !== 1)
286286
{
287287
continue;
288288
}
@@ -339,7 +339,7 @@ protected function processFilters(string $uri = null)
339339
$path = str_replace('/*', '*', $path);
340340
$path = trim(str_replace('*', '.+', $path), '/ ');
341341

342-
if (preg_match('/' . $path . '/', $uri) !== 1)
342+
if (preg_match('#' . $path . '#', $uri) !== 1)
343343
{
344344
continue;
345345
}
@@ -360,7 +360,7 @@ protected function processFilters(string $uri = null)
360360
$path = str_replace('/*', '*', $path);
361361
$path = trim(str_replace('*', '.+', $path), '/ ');
362362

363-
if (preg_match('/' . $path . '/', $uri) !== 1)
363+
if (preg_match('#' . $path . '#', $uri) !== 1)
364364
{
365365
continue;
366366
}

0 commit comments

Comments
 (0)