Skip to content

Language: Zend fatal for anonymous class in attribute ctor (#27709) - #27710

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-27709-anon-attr-const-expr
Aug 5, 2026
Merged

Language: Zend fatal for anonymous class in attribute ctor (#27709)#27710
PurHur merged 1 commit into
masterfrom
agent/issue-27709-anon-attr-const-expr

Conversation

@PurHur

@PurHur PurHur commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Emit Zend’s Cannot use anonymous class in constant expression (CompileFatal / Fatal error line) when new class {} appears in an attribute constructor argument, instead of Dynamic class name in attribute constructor new expression is not supported.
  • Named new ClassName in the same position is unchanged.
  • php-src: Zend/zend_compile.c const-expr / ZEND_ACC_ANON_CLASS; PHP path: lib/Compiler/AttributeConstantEvaluator.php (reuses FunctionStaticAnonymousClassCompileCheck::MESSAGE).

Closes #27709

Test plan

  • Issue repro (VM vs Zend)
  • AttributeConstructorNewTest (4 tests)

Verification

ZEND:
PHP Fatal error:  Cannot use anonymous class in constant expression in /tmp/anon_attr.php on line 5
ZEND_EXIT:255
VM:
Fatal error: Cannot use anonymous class in constant expression in /tmp/anon_attr.php on line 4
VM_EXIT:255
VM_NAMED: reached  (exit 0)

php -d memory_limit=1536M vendor/bin/phpunit --filter AttributeConstructorNewTest
OK (4 tests, 5 assertions)

Pre-claim gates: inventory OK 7009/7009; bootstrap-selfhost-link OK (gen-0 sidecar fallback). release-readiness north-star5-fast fail is pre-existing gen-0 manifest/driver mismatch (#8713), not touched by this PR.

Made with Cursor

Match php-src const-expr rejection (Cannot use anonymous class in constant
expression) instead of the Dynamic class name parseAndCompile string.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit f9985ea into master Aug 5, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-27709-anon-attr-const-expr branch August 5, 2026 09:03
PurHur added a commit that referenced this pull request Aug 5, 2026
…27714) (#27729)

north-star5-verify-fast step 4f-m failed: lowering_source_fingerprint lagged
live sources after lowering commits past #27701. Zend-rebuild the committed
argv driver with verified-fresh provenance (no restamp).

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 5, 2026
north-star5-verify-fast step 4f-m failed: lowering_source_fingerprint
lagged live sources after anonymous-class-in-attribute-ctor fatal.
Zend-rebuild the committed argv driver with verified-fresh provenance
(no restamp); inventory doc picks up AttributeConstantEvaluator warning.

Co-authored-by: Cursor <cursoragent@cursor.com>
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: anonymous class in attribute ctor — wrong fatal (Zend/zend_compile.c constant expression)

1 participant