[6.x] Fix runtime assignment in a partial blanking a later partial's slot - #15014
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #14833.
A runtime assignment inside a non-pair partial could blank the
{{ slot }}of a later pair partial on the same page. With these three templates:the card rendered
<slot></slot>instead of<slot>KEEPME</slot>, silently and with no errors logged.The cause is in
evaluatePhpBuffer(), which captures assignments from{{? ?}}nodes by diffingget_defined_vars()before and after the eval. The guard that skips unchanged scope variables usesisset(), which returns false for pre-existing null values. A non-pair partial'sslotis exactly that (null), so it was misclassified as a fresh assignment and pushed into the traced runtime assignments, where it later overwrote the pair partial's real slot content once any tag ran in its body. The guard was added in #13939 to stop PHP nodes clobbering the parent scope, but theisset()check left this null hole open.This changes the check to
array_key_exists(), so pre-existing null scope variables are recognized as unchanged. New variables (absent from the before-snapshot) and genuine null-to-value changes are still captured exactly as before.Verified against the repro from the issue: before, the page rendered
FILTERhi<slot></slot>; after,FILTERhi<slot>KEEPME</slot>. The full Antlers suite passes, including the #13939 guard test.🤖 Generated with Claude Code