mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 22:42:14 +00:00
Make sure parameter-modifier is found before parsing parameters.
This commit is contained in:
@@ -48,6 +48,9 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = ($url === '/') ? '/' : '/' . trim($url, '/') . '/';
|
||||
|
||||
if(strpos($this->url, $this->paramModifiers[0]) !== false) {
|
||||
|
||||
$regex = sprintf(static::PARAMETERS_REGEX_MATCH, $this->paramModifiers[0], $this->paramOptionalSymbol, $this->paramModifiers[1]);
|
||||
|
||||
if (preg_match_all('/' . $regex . '/is', $this->url, $matches)) {
|
||||
@@ -60,6 +63,8 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user