mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 14:57:23 +08:00
The first rule of a template can not start with a "/", even if it has a default value
This commit is contained in:
@@ -125,7 +125,7 @@ class UrlRule extends Object
|
||||
if (isset($this->defaults[$name])) {
|
||||
$length = strlen($match[0][0]);
|
||||
$offset = $match[0][1];
|
||||
if ($this->pattern[$offset - 1] === '/' && $this->pattern[$offset + $length] === '/') {
|
||||
if ($offset > 1 && $this->pattern[$offset - 1] === '/' && $this->pattern[$offset + $length] === '/') {
|
||||
$tr["/<$name>"] = "(/(?P<$name>$pattern))?";
|
||||
} else {
|
||||
$tr["<$name>"] = "(?P<$name>$pattern)?";
|
||||
|
||||
Reference in New Issue
Block a user