Repository navigation
Closed
Labels
area:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language featuresPhase 2 – language featuresstdlib
Description
Category
language · php-src-strict · PHP 8.4 property hooks
Problem
When a property set hook throws, the exception must propagate to the assignment expression (catchable by user try/catch). Zend resumes normal exception flow from $obj->prop = $value.
Symmetric read-site issue: #10309 — get-hook throws on $obj->prop read must propagate to the fetch expression.
class C {
public int $x {
get => $this->x;
set { throw new Exception('set hook'); }
}
private int $x = 0;
}
$c = new C();
try {
$c->x = 1;
echo "no-resume\n";
} catch (Throwable $e) {
echo 'caught: ', $e->getMessage(), "\n";
}
// Zend PHP 8.4+: caught: set hookBlocked today by #9831 (hook + private backing → compile Cannot redeclare C::$x). After #9831 lands, verify set-hook throw/resume semantics.
php-src reference
- php/php-src
Zend/zend_property_hooks.c— set/get hook invocation + exception unwind - php/php-src
Zend/zend_exceptions.c— throw from hook body - Tests:
Zend/tests/property_hooks/property_hooks_set_exception*.phpt,property_hooks_get_exception*.phpt
Repro
Set hook (this issue): test/repro/maintainer_gap_property_hook_set_exception.php
Get hook (#10309): test/repro/maintainer_gap_property_hook_get_throw.php
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_gap_property_hook_set_exception.php
php bin/vm.php test/repro/maintainer_gap_property_hook_get_throw.php
'| Engine | Set repro | Get repro (#10309) |
|---|---|---|
| Zend PHP 8.4+ | caught: set hook |
caught: get hook |
| VM today | compile fail (#9831) | verify after #9831 |
Scope (PHP-in-PHP)
| Layer | Path |
|---|---|
| VM | lib/VM/PropertyHook*.php, read/write opcodes |
| Compiler | #9831 hook + backing compile |
| JIT | #10112 PropertyHookDispatch — VM SSOT first |
| Tests | test/compliance/cases/language/property_hook_set_throw.phpt, property_hook_get_throw.phpt |
Done when (php-src-strict)
- Set repro prints
caught: set hookon VM (nono-resume) - Language: property hook get hook thrown exceptions must propagate to read site (Zend/zend_property_hooks.c) #10309 get repro green on same VM hook implementation
- Exception class/message match Zend
- JIT write/read paths agree with VM when in scope
-
./script/ci-fast.sh --filter property_hookgreen
Related
- Language: property hook + private backing field — compile Cannot redeclare (Zend/zend_compile.c) #9831 · Language: property hook get hook thrown exceptions must propagate to read site (Zend/zend_property_hooks.c) #10309 get-hook throws · php-in-php: JIT PropertyHookDispatch — route property hook LLVM through VmPropertyHook PHP not ~475-line monolith (#1492) #10112 · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492
Metadata
Metadata
Assignees
Labels
area:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language featuresPhase 2 – language featuresstdlib
Activity
PurHur commentedon Jun 20, 2026
claim: cursor-agent-lane-a — runtime already green after #9831; adding compliance guard + closing
PurHur commentedon Jun 20, 2026
claim released: already fixed —
property_hook_set_throw.phpt(#9670) covers set-hook exception propagation; VM repro green.PurHur commentedon Jun 23, 2026
Closing as stale: repro green on master 2026-06-23.
php bin/vm.php test/repro/maintainer_gap_property_hook_set_exception.php→caught: set hook(compliance covered by
property_hook_set_throw.phptper prior claim comment).