Skip to content

[6.x] Fix runtime assignment in a partial blanking a later partial's slot - #15014

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
mynetx:fix/antlers-partial-slot-leak
Jul 15, 2026
Merged

[6.x] Fix runtime assignment in a partial blanking a later partial's slot#15014
jasonvarga merged 1 commit into
statamic:6.xfrom
mynetx:fix/antlers-partial-slot-leak

Conversation

@mynetx

@mynetx mynetx commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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:

{{# page #}}
{{? $foo = 'bar' ?}}
{{ partial:filter }}
{{ partial:card }}KEEPME{{ /partial:card }}

{{# filter (non-pair) #}}
{{? $values = 'v' ?}}FILTER

{{# card (pair) #}}
{{ trans key='hi' }}<slot>{{ slot }}</slot>

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 diffing get_defined_vars() before and after the eval. The guard that skips unchanged scope variables uses isset(), which returns false for pre-existing null values. A non-pair partial's slot is 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 the isset() 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

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit 507259c into statamic:6.x Jul 15, 2026
20 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.

Runtime assignment in a non-pair partial leaks slot => null, blanking a later partial's {{ slot }}

2 participants