Commit ea8c6e18 authored by Eric Barnes's avatar Eric Barnes

Fixed route handles for uri's that partially match

parent 9bcbe6a3
......@@ -118,7 +118,7 @@ class Route {
*/
public function response()
{
// If the action is a string, it is simply pointing the route to a
// If the action is a string, it is simply pointing the route to a
// controller action, and we can just call the action and return
// its response. This is the most basic form of route, and is
// the simplest to handle.
......@@ -214,7 +214,7 @@ class Route {
*/
public function handles($uri)
{
$pattern = ($uri !== '/') ? str_replace('*', '(.*)', $uri) : '^/$';
$pattern = ($uri !== '/') ? str_replace('*', '(.*)', $uri).'\z' : '^/$';
return ! is_null(array_first($this->uris, function($key, $uri) use ($pattern)
{
......
......@@ -24,6 +24,7 @@ class RouteTest extends PHPUnit_Framework_TestCase {
$this->assertFalse($route->handles('/'));
$this->assertFalse($route->handles('baz'));
$this->assertFalse($route->handles('/foo'));
$this->assertFalse($route->handles('foo'));
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /', 'GET /home')));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment