From c15199386bfdef0e1d93e18e6508e572c7f4d95a Mon Sep 17 00:00:00 2001 From: Tim Plunkett Date: Mon, 25 Aug 2014 23:33:54 -0700 Subject: [PATCH] Move local $requestForMatching variable initialization outside loop. --- ChainRouter.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ChainRouter.php b/ChainRouter.php index f9c49f5f..a544bb0e 100644 --- a/ChainRouter.php +++ b/ChainRouter.php @@ -164,15 +164,14 @@ private function doMatch($url, Request $request = null) { $methodNotAllowed = null; + $requestForMatching = $request; foreach ($this->all() as $router) { try { // the request/url match logic is the same as in Symfony/Component/HttpKernel/EventListener/RouterListener.php // matching requests is more powerful than matching URLs only, so try that first if ($router instanceof RequestMatcherInterface) { - if (null === $request) { + if (empty($requestForMatching)) { $requestForMatching = Request::create($url); - } else { - $requestForMatching = $request; } return $router->matchRequest($requestForMatching);