Skip to content

Commit

Permalink
Merge branch 'hotfix/2922'
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Dec 11, 2012
2 parents 44cac94 + 78e8145 commit 37277ab
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
2 changes: 1 addition & 1 deletion library/Zend/Mvc/Router/Http/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function match(Request $request, $pathOffset = null)
$uri = $request->getUri();
$pathLength = strlen($uri->getPath());

if ($this->mayTerminate && $nextOffset === $pathLength) {
if ($this->mayTerminate && $nextOffset === $pathLength && trim($uri->getQuery()) == "") {
return $match;
}

Expand Down
68 changes: 65 additions & 3 deletions tests/ZendTest/Mvc/Router/Http/PartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,38 @@ public static function getRoute()
)
);
}

public static function getRouteAlternative ()
{
$routePlugins = new RoutePluginManager();
$routePlugins->setInvokableClass('part', 'Zend\Mvc\Router\Http\Part');
return new Part(
array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'defaults' => array(
'controller' => 'fo-fo',
'action' => 'index'
)
)
), true, $routePlugins,
array(
'wildcard' => array(
'type' => 'Zend\Mvc\Router\Http\Wildcard',
'options' => array(
'key_value_delimiter' => '/',
'param_delimiter' => '/'
)
),
'query' => array(
'type' => 'Zend\Mvc\Router\Http\Query',
'options' => array(
'key_value_delimiter' => '=',
'param_delimiter' => '&'
)
)
));
}
public static function routeProvider()
{
return array(
Expand Down Expand Up @@ -122,14 +153,14 @@ public static function routeProvider()
'offset-does-not-enable-partial-matching' => array(
self::getRoute(),
'/foo/foo',
0,
null,
null,
null
),
'offset-does-not-enable-partial-matching-in-child' => array(
self::getRoute(),
'/foo/bar/baz',
0,
null,
null,
null
),
Expand Down Expand Up @@ -175,6 +206,37 @@ public static function routeProvider()
'bat/optional',
array('foo' => 'bar')
),
'simple-match' => array(
self::getRouteAlternative(),
'/',
null,
null,
array(
'controller' => 'fo-fo',
'action' => 'index'
)
),
'match-wildcard' => array(
self::getRouteAlternative(),
'/fo-fo/index/param1/value1',
null,
'wildcard',
array(
'controller' => 'fo-fo',
'action' => 'index',
'param1' => 'value1'
)
),
'match-query' => array(
self::getRouteAlternative(),
'/fo-fo/index?param1=value1',
0,
'query',
array(
'controller' => 'fo-fo',
'action' => 'index'
)
)
);
}

Expand Down

0 comments on commit 37277ab

Please sign in to comment.