Skip to content

Commit ba30a6d

Browse files
authored
avoid error during error reporting in chain router (#216)
the UrlGeneratorInterface::generate is not very specific about $parameters and allows non-arrays. simple solution as its only about reporting in an edge case of an error situation.
1 parent 3a76d1a commit ba30a6d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ChainRouter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ private function rebuildRequest($pathinfo)
288288
private function getErrorMessage($name, $router = null, $parameters = null)
289289
{
290290
if ($router instanceof VersatileGeneratorInterface) {
291+
// the $parameters are not forced to be array, but versatile generator does typehint it
292+
if (!is_array($parameters)) {
293+
$parameters = [];
294+
}
291295
$displayName = $router->getRouteDebugMessage($name, $parameters);
292296
} elseif (is_object($name)) {
293297
$displayName = method_exists($name, '__toString')

0 commit comments

Comments
 (0)