⏱️ Replace preg_replace in tokenize with str_replace

This commit is contained in:
Skylear 2021-07-15 17:26:28 -05:00
parent 236612125e
commit 559196be54

View File

@ -131,12 +131,12 @@ class Router
$matches = $matches[1]; $matches = $matches[1];
foreach ($matches as $match) { foreach ($matches as $match) {
$pattern = "/(?:{".$match."})+/"; $pattern = '{'.$match.'}';
if (in_array($match, $constraints)) { if (in_array($match, $constraints)) {
$uri = preg_replace($pattern, '('.self::$constraints[$match].')', $uri); $uri = str_replace($pattern, '('.self::$constraints[$match].')', $uri);
} else { } else {
$uri = preg_replace($pattern, self::$defaultConstraint, $uri); $uri = str_replace($pattern, self::$defaultConstraint, $uri);
} }
} }