mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-08-03 15:07:43 +02:00
Merge pull request #78 from koenpunt/escape-dash
escape dash to fix tests
This commit is contained in:
@@ -186,7 +186,8 @@ class AltoRouter {
|
|||||||
if ($_route === '*') {
|
if ($_route === '*') {
|
||||||
$match = true;
|
$match = true;
|
||||||
} elseif (isset($_route[0]) && $_route[0] === '@') {
|
} elseif (isset($_route[0]) && $_route[0] === '@') {
|
||||||
$match = preg_match('`' . substr($_route, 1) . '`u', $requestUrl, $params);
|
$pattern = '`' . substr($_route, 1) . '`u';
|
||||||
|
$match = preg_match($pattern, $requestUrl, $params);
|
||||||
} else {
|
} else {
|
||||||
$route = null;
|
$route = null;
|
||||||
$regex = false;
|
$regex = false;
|
||||||
|
@@ -351,7 +351,7 @@ class AltoRouterTest extends PHPUnit_Framework_TestCase
|
|||||||
$pattern .= '\x{FE70}-\x{FEFF}';
|
$pattern .= '\x{FE70}-\x{FEFF}';
|
||||||
$pattern .= '\x{0750}-\x{077F}';
|
$pattern .= '\x{0750}-\x{077F}';
|
||||||
// Alphanumeric, /, _, - and space characters
|
// Alphanumeric, /, _, - and space characters
|
||||||
$pattern .= 'a-zA-Z0-9\/_-\s';
|
$pattern .= 'a-zA-Z0-9\/_\-\s';
|
||||||
// 'ZERO WIDTH NON-JOINER'
|
// 'ZERO WIDTH NON-JOINER'
|
||||||
$pattern .= '\x{200C}';
|
$pattern .= '\x{200C}';
|
||||||
$pattern .= ']+)';
|
$pattern .= ']+)';
|
||||||
|
Reference in New Issue
Block a user