mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
Added unicode parameter regex support.
This commit is contained in:
@@ -74,7 +74,7 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
||||
|
||||
$regex = sprintf(static::PARAMETERS_REGEX_FORMAT, $this->paramModifiers[0], $this->paramOptionalSymbol, $this->paramModifiers[1]);
|
||||
|
||||
if (preg_match_all('/' . $regex . '/', $this->url, $matches)) {
|
||||
if (preg_match_all('/' . $regex . '/u', $this->url, $matches)) {
|
||||
$this->parameters = array_fill_keys($matches[1], null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ abstract class Route implements IRoute
|
||||
// Ensures that hostnames/domains will work with parameters
|
||||
$url = '/' . ltrim($url, '/');
|
||||
|
||||
if (preg_match_all('/' . $regex . '/', $route, $parameters)) {
|
||||
if (preg_match_all('/' . $regex . '/u', $route, $parameters)) {
|
||||
|
||||
$urlParts = preg_split('/((\-?\/?)\{[^}]+\})/', rtrim($route, '/'));
|
||||
|
||||
@@ -154,7 +154,7 @@ abstract class Route implements IRoute
|
||||
$urlRegex = preg_quote($route, '/');
|
||||
}
|
||||
|
||||
if (preg_match('/^' . $urlRegex . '\/?$/', $url, $matches) > 0) {
|
||||
if (preg_match('/^' . $urlRegex . '\/?$/u', $url, $matches) > 0) {
|
||||
|
||||
$values = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user