From 853155b759d1045dd6935cc71d9588d2223f9a69 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 5 Aug 2011 13:52:30 -0700 Subject: [PATCH] Fixed issue with empty named parameters --- flight/Router.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flight/Router.php b/flight/Router.php index 89d629b..a80d6b5 100644 --- a/flight/Router.php +++ b/flight/Router.php @@ -36,7 +36,8 @@ class Router { * Tries to match a requst to a route. Also parses named parameters in the url. * * @param string $pattern URL pattern - * @param object $request Request object + * @param string $url Request URL + * @param array $params Named URL parameters */ public function match($pattern, $url, array &$params = array()) { $ids = array(); @@ -50,7 +51,7 @@ class Router { else if ($str{0} == '@') { if (preg_match('/@(\w+)(\:([^\/]*))?/', $str, $matches)) { $ids[$matches[1]] = true; - return '(?P<'.$matches[1].'>'.(isset($matches[3]) ? $matches[3] : '[^(\/|\?)]*').')'; + return '(?P<'.$matches[1].'>'.(isset($matches[3]) ? $matches[3] : '[^(\/|\?)]+').')'; } } return $str;