Skip to content

[6.x] Fix error response codes sticking to later pages in long-lived processes - #15454

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
petemolinero:fix/cascade-hydrated-callback-accumulation
Sep 14, 2026
Merged

jasonvarga merged 1 commit into
statamic:6.xfrom
petemolinero:fix/cascade-hydrated-callback-accumulation

Conversation

@petemolinero

Copy link
Copy Markdown
Contributor

When rendering an HTTP error page, RendersHttpExceptions::contents() registers a Cascade::hydrated() callback to set response_code. The problem is, that response code is currently sticky in long-lived processes (e.g. Octane). For example, after a single 404, every later page rendered by that process reports the error code in its cascade.

How we prevent response codes sticking between requests

Add a new method to handle situations where we want to register a callback that can only be consumed once, but is then removed. It's similar to flash messages in regular PHP applications ("after consumed once, delete"). Then, we use that new method for the response code callback.

@jasonvarga
jasonvarga merged commit 9fe6622 into statamic:6.x Sep 14, 2026
62 checks passed
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.

2 participants