Skip to content

Resolving middleware breaks if resolver throws unexpected exception type #3071

@Rarst

Description

@Rarst

CallableResolver call is wrapped in a catch that expects RuntimeException

if ($this->callableResolver instanceof CallableResolverInterface) {
try {
$callable = $this->callableResolver->resolve($this->middleware);
} catch (RuntimeException $e) {
// Do Nothing
}
}
if (!$callable) {

If a resolver throws exception that doesn't extend from RuntimeException this halts the execution and fallback code below is never reached.

Real example of the issue with third party resolver: PHP-DI/Slim-Bridge#51

I am not sure what's the reasoning for specifically RuntimeException here, but broadening it to Exception might be a good idea for resilience?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions