From 57e175552a07eb2de69aa2793ead734a7c35a3b7 Mon Sep 17 00:00:00 2001 From: LAV45 Date: Wed, 8 May 2013 18:10:02 +0300 Subject: [PATCH] The first rule of a template can not start with a "/", even if it has a default value --- framework/web/UrlRule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/web/UrlRule.php b/framework/web/UrlRule.php index 53bd747..96cb994 100644 --- a/framework/web/UrlRule.php +++ b/framework/web/UrlRule.php @@ -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)?";