Category
language
Problem
PHP 8.4 property hooks (get / set on properties) are not parsed or lowered. php-parser / php-cfg may need upgrades; compiler has no hook dispatch on property read/write.
Framework DTOs and validated properties (email, status codes) increasingly use hooks instead of manual __get/__set.
php-src reference
Repro — set hook (failure today)
Save as property_hook_set.php:
<?php
class User {
public string $email {
set (string $value) {
if (!str_contains($value, '@')) {
throw new InvalidArgumentException('email');
}
$this->email = $value;
}
}
}
$user = new User();
$user->email = 'bad';
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php property_hook_set.php'
php property_hook_set.php # Zend 8.4+: InvalidArgumentException
| Runtime |
Today |
| Zend PHP 8.4+ |
InvalidArgumentException: email |
bin/vm.php |
Parse / compile error (unsupported property syntax) |
Repro — get hook (phase 2 in same issue or follow-up)
<?php
class Box {
public int $total {
get => $this->items * $this->unit;
}
public function __construct(private int $items, private int $unit) {}
}
$box = new Box(3, 10);
echo $box->total, "\n";
Done when: prints 30 on VM like Zend 8.4.
Scope (this repo)
| Module |
Path |
| Parser/cfg |
vendor php-parser / php-cfg patches — preserve hook bodies on property nodes |
| Compiler |
lib/Compiler.php — hook dispatch on property fetch/assign |
| VM |
lib/VM.php — invoke hook closures with correct $this; backing value storage |
| Lint |
lib/Lint/UnsupportedRegistry.php — remove mapping when VM path exists |
| Tests |
test/compliance/cases/language/property_hook_set.phpt, property_hook_get.phpt |
| Matrix |
script/capability-syntax.php — row for property hooks |
Not: internal_* permanent shims; full JIT/AOT in v1 (VM-first).
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter property_hook'
./script/docker-exec.sh -- bash -lc 'php script/capability-syntax.php'
Dependencies
Links
Category
languageProblem
PHP 8.4 property hooks (
get/seton properties) are not parsed or lowered. php-parser / php-cfg may need upgrades; compiler has no hook dispatch on property read/write.Framework DTOs and validated properties (email, status codes) increasingly use hooks instead of manual
__get/__set.php-src reference
Zend/zend_compile.c— property hook AST →ZEND_PROPERTY_HOOK_GET/SETopcodesZend/zend_object_handlers.c— hook invocation on read/writeZend/zend_property_hooks.c— PHP 8.4 hook runtime (if split in tree)Repro —
sethook (failure today)Save as
property_hook_set.php:InvalidArgumentException: emailbin/vm.phpRepro —
gethook (phase 2 in same issue or follow-up)Done when: prints
30on VM like Zend 8.4.Scope (this repo)
lib/Compiler.php— hook dispatch on property fetch/assignlib/VM.php— invoke hook closures with correct$this; backing value storagelib/Lint/UnsupportedRegistry.php— remove mapping when VM path existstest/compliance/cases/language/property_hook_set.phpt,property_hook_get.phptscript/capability-syntax.php— row for property hooksNot:
internal_*permanent shims; full JIT/AOT in v1 (VM-first).Done when
property_hook_set.phpcompiles; invalid email throwsInvalidArgumentExceptionon VMgethook repro prints30(or tracked child issue linked)./script/ci-fast.sh --filter property_hookgreendocs/capabilities-syntax.mdrow Property hooks → VMyesVerification
Dependencies
InvalidArgumentExceptionfor repro throwsLinks