Resolving middleware breaks if resolver throws unexpected exception type
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 12.3k
- Forks
- 2k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 6
Description
CallableResolver call is wrapped in a catch that expects RuntimeException
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: https://github.com/PHP-DI/Slim-Bridge/issues/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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Slim/MiddlewareDispatcher.php around lines 214–222 and inspect how CallableResolver exceptions are caught before the fallback path. Reproduce the case with a resolver that throws an exception outside RuntimeException, then verify that the fallback code is reached without halting middleware execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100