Fixed route handles for uri's that partially match
This commit is contained in:
@@ -214,7 +214,7 @@ class Route {
|
|||||||
*/
|
*/
|
||||||
public function handles($uri)
|
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)
|
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('/'));
|
||||||
$this->assertFalse($route->handles('baz'));
|
$this->assertFalse($route->handles('baz'));
|
||||||
$this->assertFalse($route->handles('/foo'));
|
$this->assertFalse($route->handles('/foo'));
|
||||||
|
$this->assertFalse($route->handles('foo'));
|
||||||
|
|
||||||
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /', 'GET /home')));
|
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /', 'GET /home')));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user