Skip to content

Throw when middleware class is missing or cannot be resolved#697

Merged
n0nag0n merged 1 commit into
masterfrom
fix/middleware-missing-class-error
Jun 16, 2026
Merged

Throw when middleware class is missing or cannot be resolved#697
n0nag0n merged 1 commit into
masterfrom
fix/middleware-missing-class-error

Conversation

@n0nag0n

@n0nag0n n0nag0n commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Validates string middleware classes at request time instead of silently skipping them
  • Throws an exception when a middleware class cannot be autoloaded, matching the error message used for missing route handler classes
  • Throws when a middleware class with a container cannot be resolved
  • Preserves existing behavior where middleware that only implements before or after is skipped for the other phase

Test plan

  • Added testMiddlewareMissingClassThrowsException for route-level middleware
  • Added testMiddlewareMissingClassInGroupThrowsException for group middleware
  • All 471 existing tests pass

Fixes #696

String middleware classes that do not exist or fail container
resolution are now validated at request time, matching route
handler behavior. Middleware that only implements one phase
(before/after) continues to be skipped for the other phase.

Fixes #696
@n0nag0n n0nag0n merged commit 49b750c into master Jun 16, 2026
7 checks passed
@n0nag0n n0nag0n deleted the fix/middleware-missing-class-error branch June 16, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing middleware classes without error!

1 participant