Skip to content

Commit

Permalink
ControllerResolver::getController return value check
Browse files Browse the repository at this point in the history
  • Loading branch information
fracsi authored and javiereguiluz committed Oct 16, 2024
1 parent 3107225 commit 7cc04d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Factory/ControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ private function getController(string $controllerInterface, ?string $controllerF
}

$newRequest = $request->duplicate(null, null, ['_controller' => [$controllerFqcn, $controllerAction]]);
$controllerCallable = $this->controllerResolver->getController($newRequest);
try {
$controllerCallable = $this->controllerResolver->getController($newRequest);
} catch (\InvalidArgumentException $e) {
$controllerCallable = false;
}

if (false === $controllerCallable) {
throw new NotFoundHttpException(sprintf('Unable to find the controller "%s::%s".', $controllerFqcn, $controllerAction));
Expand Down

0 comments on commit 7cc04d0

Please sign in to comment.