Skip to content

Language: reject self/parent/static::method in free functions (#32227) - #32242

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-32227-static-call-no-scope
Aug 18, 2026
Merged

PurHur merged 2 commits into
masterfrom
agent/issue-32227-static-call-no-scope

Conversation

@PurHur

@PurHur PurHur commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

  • Issue repro VM + JIT (rc=255, Zend substring, never prints accepted)
  • ./script/phpunit.sh --filter PseudoClassCallNoScope32227
  • ./script/phpunit.sh --filter PseudoClassStaticCallCompileFatalTest
  • php script/bootstrap-inventory.php --checkOK 7590/7590 (Docker regen; no gen-0 restamp)

Verification

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_static_call_no_scope.php >/tmp/o.txt 2>&1; echo RC:$?; cat /tmp/o.txt'
RC:255
PHP Fatal error:  Cannot use "static" when no class scope is active in /compiler/test/repro/maintainer_gap_static_call_no_scope.php on line 8

Same Zend substring + rc=255 for maintainer_gap_self_call_no_scope.php, maintainer_gap_parent_call_no_scope.php, and php bin/jit.php on the static repro.

./script/phpunit.sh --filter 'PseudoClassCallNoScope32227|PseudoClassStaticCallCompileFatalTest|PseudoClassGlobalScopeCompileTest'
OK (18 tests, 36 assertions)
./script/docker-exec.sh -- bash -lc 'php script/bootstrap-inventory.php --check'
OK 7590/7590

Did not run full make test-harness or north-star5-verify --strict.

Made with Cursor

PurHur and others added 2 commits August 18, 2026 14:02
Zend zend_ensure_valid_class_fetch_type() is a compile-time fatal when a named
free function uses self/parent/static::method (or ::class) with no class scope.
File-level and closures still compile — they inherit or rebind at runtime.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ile fatals (#32227)

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit b8c6d03 into master Aug 18, 2026
0 of 2 checks passed
@PurHur
PurHur deleted the agent/issue-32227-static-call-no-scope branch August 18, 2026 14:03
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: static::/self::/parent:: method call in function compiles — Zend Cannot use "static" when no class scope is active (Zend/zend_compile.c)

1 participant