[URLMAPPER] Fix small bug in URLMapper: a dynamic route might not exist even if a static one does

This commit is contained in:
Miguel Dantas 2019-08-24 00:01:24 +01:00 committed by Diogo Cordeiro
parent 10b3b343dd
commit 6d81848f25

View File

@ -169,8 +169,8 @@ class URLMapper
throw new Exception(sprintf('No candidate paths for action "%s"', $action)); throw new Exception(sprintf('No candidate paths for action "%s"', $action));
} }
if (array_key_exists($action, $this->reverse_dynamics)){
$candidates = $this->reverse_dynamics[$action]; $candidates = $this->reverse_dynamics[$action];
foreach ($candidates as $candidate) { foreach ($candidates as $candidate) {
list($tryArgs, $format, $paramNames) = $candidate; list($tryArgs, $format, $paramNames) = $candidate;
@ -201,9 +201,10 @@ class URLMapper
return $path; return $path;
} }
}
if (array_key_exists($action, $this->reverse_statics)) {
$candidates = $this->reverse_statics[$action]; $candidates = $this->reverse_statics[$action];
foreach ($candidates as $candidate) { foreach ($candidates as $candidate) {
list($tryArgs, $tryPath) = $candidate; list($tryArgs, $tryPath) = $candidate;
@ -224,6 +225,7 @@ class URLMapper
return $path; return $path;
} }
}
// failure; some reporting twiddles // failure; some reporting twiddles