Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
8bff031f
Commit
8bff031f
authored
Oct 10, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the issue that dots in URL rules would match any character.
parent
817516ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
UrlRule.php
framework/yii/web/UrlRule.php
+1
-0
UrlRuleTest.php
tests/unit/framework/web/UrlRuleTest.php
+11
-0
No files found.
framework/yii/web/UrlRule.php
View file @
8bff031f
...
@@ -156,6 +156,7 @@ class UrlRule extends Object
...
@@ -156,6 +156,7 @@ class UrlRule extends Object
}
}
}
}
}
}
$tr
[
'.'
]
=
'\\.'
;
$this
->
_template
=
preg_replace
(
'/<(\w+):?([^>]+)?>/'
,
'<$1>'
,
$this
->
pattern
);
$this
->
_template
=
preg_replace
(
'/<(\w+):?([^>]+)?>/'
,
'<$1>'
,
$this
->
pattern
);
$this
->
pattern
=
'#^'
.
trim
(
strtr
(
$this
->
_template
,
$tr
),
'/'
)
.
'$#u'
;
$this
->
pattern
=
'#^'
.
trim
(
strtr
(
$this
->
_template
,
$tr
),
'/'
)
.
'$#u'
;
...
...
tests/unit/framework/web/UrlRuleTest.php
View file @
8bff031f
...
@@ -380,6 +380,17 @@ class UrlRuleTest extends TestCase
...
@@ -380,6 +380,17 @@ class UrlRuleTest extends TestCase
),
),
),
),
array
(
array
(
'with dot'
,
// https://github.com/yiisoft/yii/issues/2945
array
(
'pattern'
=>
'posts.html'
,
'route'
=>
'post/index'
,
),
array
(
array
(
'posts.html'
,
'post/index'
),
array
(
'postsahtml'
,
false
),
),
),
array
(
'creation only'
,
'creation only'
,
array
(
array
(
'pattern'
=>
'posts'
,
'pattern'
=>
'posts'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment