Category
language · php-src-strict · regression on closed #3238
Problem
Trait use adaptations (insteadof precedence + as alias) compile but do not merge adapted methods onto the using class. C::f() and aliased C::g() are undefined at runtime despite valid use TA, TB { TA::f insteadof TB; TB::f as g; }.
php-src reference
Repro
test/repro-maintainer/trait_use_adaptations.php:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro-maintainer/trait_use_adaptations.php'
# VM today: Fatal "Call to undefined method C::f()"; Zend: AB
Implementation hints (PHP-in-PHP)
- Fix trait adaptation merge in compiler/VM (
applyTraitUsesWithAdaptations, class entry materialization)
- Compliance guard:
test/compliance/cases/language/trait_use_adaptations.phpt
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro-maintainer/trait_use_adaptations.php'
Category
language· php-src-strict · regression on closed #3238Problem
Trait use adaptations (
insteadofprecedence +asalias) compile but do not merge adapted methods onto the using class.C::f()and aliasedC::g()are undefined at runtime despite validuse TA, TB { TA::f insteadof TB; TB::f as g; }.php-src reference
Zend/zend_compile.c— trait alias/precedenceZend/zend_inheritance.c— trait method compositionRepro
test/repro-maintainer/trait_use_adaptations.php:Implementation hints (PHP-in-PHP)
applyTraitUsesWithAdaptations, class entry materialization)test/compliance/cases/language/trait_use_adaptations.phptDone when
ABunder VM (php-src-strict)Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro-maintainer/trait_use_adaptations.php'