Skip to content

fix(router): skip sessions for stateless routes#2143

Merged
xHeaven merged 1 commit into
tempestphp:3.xfrom
xHeaven:fix/middleware-prio
Jun 2, 2026
Merged

fix(router): skip sessions for stateless routes#2143
xHeaven merged 1 commit into
tempestphp:3.xfrom
xHeaven:fix/middleware-prio

Conversation

@xHeaven
Copy link
Copy Markdown
Member

@xHeaven xHeaven commented Jun 2, 2026

Fixes #2065.

Note: this makes it so sessions won't run for unmatched/404 routes, because the matcher now short-circuits before the session middleware. Not sure if this is acceptable.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

Benchmark Results

Comparison of fix/middleware-prio against 3.x (08cc44693058b3ffb4a33e4b4d6590da4a9a3356).

Open to see the benchmark results
Benchmark Set Mem. Peak Time Variability
QueryExecutionBench(benchFetchAll) - 4.349mb 0.00% 46.860μs +5.30% ±2.90% +122.87%
GenericRouterBench(benchDispatch) Dynamic route 5.139mb +0.04% 69.626μs -5.93% ±0.59% -65.21%
GenericRouterBench(benchDispatch) Dynamic short 5.139mb +0.04% 69.470μs -5.90% ±0.43% +51.59%
GenericRouterBench(benchDispatchWithoutMiddleware) Dynamic route 5.138mb +0.04% 58.979μs -6.66% ±1.17% +56.31%
GenericRouterBench(benchDispatchWithoutMiddleware) Dynamic short 5.138mb +0.04% 58.835μs -6.26% ±1.17% +373.54%

Generated by phpbench against commit 00b28ec

@brendt
Copy link
Copy Markdown
Member

brendt commented Jun 2, 2026

so sessions won't run for unmatched/404 routes

I can't think of any problem this would cause, so let's merge and see 👍

@xHeaven xHeaven merged commit efe6c32 into tempestphp:3.x Jun 2, 2026
76 checks passed
@xHeaven xHeaven deleted the fix/middleware-prio branch June 2, 2026 13:17
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.

ManageSessionMiddleware runs even with Stateless attr

2 participants