Skip to content
Browse files

Revert "small fix for query string"

This reverts commit fb7c01a.
  • Loading branch information...
1 parent fb7c01a commit 27dce2ece1d8810463ead1dbd77c3fb83802080a Alexandre Gaigalas committed Aug 17, 2011
Showing with 4 additions and 8 deletions.
  1. +1 −1 library/Respect/Rest/Request.php
  2. +3 −7 library/Respect/Rest/Routes/AbstractRoute.php
View
2 library/Respect/Rest/Request.php
@@ -23,7 +23,7 @@ class Request
public function __construct($method=null, $uri=null)
{
- $uri = $uri ? : $_SERVER['REQUEST_URI'];
+ $uri = $uri ? : parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$this->uri = rtrim($uri, ' /');
$this->method = strtoupper($method ? : $_SERVER['REQUEST_METHOD']);
}
View
10 library/Respect/Rest/Routes/AbstractRoute.php
@@ -70,7 +70,7 @@ public function getRoutines()
public function getMatchPattern()
{
- return $this->matchPath;
+ return $this->matchPattern;
}
public function getMethod()
@@ -95,12 +95,9 @@ public function match(Request $request, &$params=array())
$params))
return false;
- $uri = $request->getUri();
- $uriPath = parse_url($uri, PHP_URL_PATH);
-
- if (!preg_match($this->matchPattern, $uriPath, $params))
+ if (!preg_match($this->matchPattern, $request->getUri(), $params))
return false;
-
+
if (count($params) > 1 && false !== stripos(end($params), '/')) {
$lastParam = array_pop($params);
$params = array_merge($params, explode('/', $lastParam));
@@ -111,7 +108,6 @@ public function match(Request $request, &$params=array())
protected function createRegexPatterns($path)
{
- $path = parse_url($path, PHP_URL_PATH);
$path = rtrim($path, ' /');
$extra = $this->extractCatchAllPattern($path);
$matchPattern = str_replace(

0 comments on commit 27dce2e

Please sign in to comment.
Something went wrong with that request. Please try again.