OSDN Git Service
(root)
/
php-libraries
/
Router.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
3433e53
)
Merge pull request #91 from dannyvankooten/use-preg_quote-on-regex
author
Jefersson Nathan
<admin@phpse.net>
Thu, 22 Dec 2016 02:58:12 +0000
(23:58 -0300)
committer
GitHub
<noreply@github.com>
Thu, 22 Dec 2016 02:58:12 +0000
(23:58 -0300)
Use preg_quote on regex
src/Router.php
patch
|
blob
|
history
diff --git
a/src/Router.php
b/src/Router.php
index
8a4ddf0
..
11d44bf
100755
(executable)
--- a/
src/Router.php
+++ b/
src/Router.php
@@
-113,7
+113,7
@@
class Router
}
$route = rtrim($routes->getRegex(), '/');
- $pattern =
"@^{$this->basePath}{$route}/?$@i"
;
+ $pattern =
'@^' . preg_quote($this->basePath) . preg_quote($route). '/?$@i'
;
if (!preg_match($pattern, $requestUrl, $matches)) {
continue;
}