[6.x] Reset remaining CP statics between requests in long-lived processes - #15441
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
petemolinero
force-pushed
the
fix/clear-state-cp-statics
branch
from
September 10, 2026 15:20
70b8f4b to
1b2c6f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under long-lived processes (e.g. Laravel Octane), the process serves many requests, and we need to be super careful that data doesn't leak between requests. Most of that is already taken care of by the
ClearStatelistener, which resets Antlers runtime state, stateful tags, and the URL cache after every request — but$jsonVariables,$isRenderingCpException, and breadcrumbs still leaked. This PR closes those gaps.How it solves request-to-request leakage
$jsonVariablesto a boot-time snapshot -$jsonVariablescan't just be cleared — boot-time registrations must survive. So we snapshot it once, at the start of the process's first request (the one moment where all boot-time registrations exist and no request-time ones do), and revert to that snapshot after every response.$isRenderingCpException- it's set totruewhen a CP error page renders and never set back, so one CP error would degrade every later CP response from the process. Now it's set back tofalseafter every response.Breadcrumbs::$pushedonly ever accumulates, so one request's breadcrumbs would show up on every later one. Now it's emptied after every response.Like the earlier fixes in this class (#9240, #9241, #11283), this is unconditional: it's behavior-neutral under PHP-FPM, since the resets run after the response is built and the process exits right after anyway (and with no snapshot taken — console, queue — the restore is a no-op).