Skip to content

Language: allow LazyGhostTrait in trait-const compile check (#6606) - #16958

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-6606-lazyghost-trait-compile
Jul 6, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-6606-lazyghost-trait-compile

Conversation

@PurHur

@PurHur PurHur commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • TraitClassConstConflictCheck now recognizes builtin LazyGhostTrait when verifying trait constant composition.
  • Fixes compile-time Trait "LazyGhostTrait" not found for classes using the PHP 8.4 lazy-ghost marker trait.

Root cause

The trait-const conflict pass only indexed traits declared in the compile unit. Builtin LazyGhostTrait (registered in VM context at runtime) has no constants but was rejected before class compilation could proceed.

php-src reference

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && export PHP_COMPILER_PROFILE=8.4 && php vendor/bin/phpunit --filter "reflection_lazy_property_names|ReflectionLazyPropertyNamesTest"'
# OK (6 tests)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && export PHP_COMPILER_PROFILE=8.4 && php bin/vm.php test/repro/maintainer_gap_reflection_getlazypropertynames.php'
# a / ok

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && export PHP_COMPILER_PROFILE=8.4 && php bin/vm.php test/repro/maintainer_gap_lazy_property_modifier_parse.php'
# lazy / hello / initialized / ok

Closes #6606

Made with Cursor

TraitClassConstConflictCheck treated builtin LazyGhostTrait as missing when
composing classes that use the PHP 8.4 marker trait, breaking
getLazyPropertyNames() compliance and unit tests.

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.

Stdlib: ReflectionClass::getLazyPropertyNames() — PHP 8.4 lazy property introspection missing (ext/reflection/php_reflection.c)

1 participant