Skip to content

Fix AOT spurious undef warnings on assigned {main} script CV reads (#31835 / #36081) - #36095

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-31835-aot-script-global-assign-rhs-undef-guard
Aug 31, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-31835-aot-script-global-assign-rhs-undef-guard

Conversation

@PurHur

@PurHur PurHur commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Root cause: ScopeVariableAssignedFlags::flagKey() keyed {main} script CVs off Context::$activeFunction, which can drift while later class bodies (e.g. a promoted-ctor Promo) lower in the same translation unit. $a = new A stored the assigned flag under one key; $a->x = $a TYPE_ASSIGN RHS guards checked another → spurious Undefined variable $a warnings even though output was correct.
  • Fix: use a stable '{main}\0$name' flag key whenever jitEnclosingBlock (or jitFunctionRootBlock) is the file-scope {main} body.

Regression surfaced by TypedPropSelfParent31835AotTest::testComplianceCaseMatchesZend after #36081 script-global undef guards landed.

Closes #31835 (AOT follow-up)

Verification

./script/aot-smoke.sh
# aot-smoke: 8 passed, 0 failed

./script/phpunit.sh --filter 'TypedPropSelfParent31835|UndefinedVariableScriptGlobalAot'
# OK (7 tests, 26 assertions)

Not run: full differential sweep (prior master capture green at 125/125).

Made with Cursor

…31835 / #36081).

ScopeVariableAssignedFlags keyed {main} locals off activeFunction, which can drift
while later class bodies lower in the same translation unit — markAssigned stored
under one key while TYPE_ASSIGN RHS guards checked another (e.g. $a->x = $a after
$a = new A when a promoted-ctor class appears later in the file).

Use a stable '{main}' flag key whenever jitEnclosingBlock is the file-scope body.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 90ce1de into master Aug 31, 2026
1 check passed
@PurHur
PurHur deleted the agent/issue-31835-aot-script-global-assign-rhs-undef-guard branch August 31, 2026 16:35
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.

Language: bare self/parent typed properties reject valid assignments — Zend accepts (?self/unions OK) (zend_execute / TypeCheck)

1 participant