symphonists/url_router — Issue #4: Only the first route works
Author: bauhouse
Created: 2011-11-03 05:27:22+00:00
State: open

When setting multiple routes, only the first route works as expected. All other routes are ignored.

I tracked down the problem to the `break` function. The `break` should end the loop only if a match is found. So, just move the `break` inside the if statement group.

foreach($routes as $route)
{
if(preg_match($route['from'], $path, $matches) == 1)
{
$route['routed'] = preg_replace($route['from'], $route['to'], $path);

$route['original'] = $path;

$return = $route;

break;
}
}