From 144207f1996914ca454e3cc52fa0f4e9c7f5a003 Mon Sep 17 00:00:00 2001 From: Andrew Gilman Date: Fri, 13 Sep 2019 16:16:40 +1200 Subject: [PATCH 1/2] Fixed hyphen position in regex PHP 5.5+ requires the hyphen to be escaped or moved to the end of the list to match it as a literal hyphen --- src/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Router.php b/src/Router.php index e9bd478..ad3c5db 100755 --- a/src/Router.php +++ b/src/Router.php @@ -121,7 +121,7 @@ public function match($requestUrl, $requestMethod = RequestMethodInterface::METH $params = array(); - if (preg_match_all('/:([\w-%]+)/', $routes->getUrl(), $argument_keys)) { + if (preg_match_all('/:([\w%-]+)/', $routes->getUrl(), $argument_keys)) { // grab array with matches $argument_keys = $argument_keys[1]; From 0f2360ec1c075147ba6d75c898afe05e1bbbb701 Mon Sep 17 00:00:00 2001 From: Andrew Gilman Date: Fri, 13 Sep 2019 17:01:28 +1200 Subject: [PATCH 2/2] Another regex re-ordering --- src/Route.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Route.php b/src/Route.php index cd8097e..216ec7f 100755 --- a/src/Route.php +++ b/src/Route.php @@ -153,7 +153,7 @@ private function substituteFilter($matches) return $this->filters[$matches[1]]; } - return '([\w-%]+)'; + return '([\w%-]+)'; } public function getParameters()