Category
Language · php-src-strict / magic property increment
Problem
$obj->n++ when n is not a declared property and the class implements __get/__set must go through magic (Zend zend_std_get_property_ptr_ptr + __get/__set) without Undefined property. The VM already calls __get/__set and the stored value matches (inc=2), but it also emits Warning: Undefined property: M::$n from the #29241 BP_VAR_RW path (warnUndefinedPropertyAfterIncDecRwFetch). That warning is for a missing plain property, not a magic one.
+= on the same object is already silent (parity OK). Inverse of closed #29241 (omit warning when there is no __get).
Probed 2026-08-18 @ aa2e5e8b62 — Zend 8.2.32 vs php bin/vm.php / php bin/jit.php.
| Repro |
Zend 8.2.32 |
VM / JIT |
$m->n++ with __get/__set backing n=>1 |
inc=2, no warning |
inc=2 + Undefined property: M::$n |
$m->n += 2 on the same class |
plus=3, no warning |
plus=3, no warning (parity OK) |
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_magic_prop_inc.php'
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_magic_prop_inc.php'
Done when
Category
Language· php-src-strict / magic property incrementProblem
$obj->n++whennis not a declared property and the class implements__get/__setmust go through magic (Zendzend_std_get_property_ptr_ptr+__get/__set) withoutUndefined property. The VM already calls__get/__setand the stored value matches (inc=2), but it also emitsWarning: Undefined property: M::$nfrom the #29241 BP_VAR_RW path (warnUndefinedPropertyAfterIncDecRwFetch). That warning is for a missing plain property, not a magic one.+=on the same object is already silent (parity OK). Inverse of closed #29241 (omit warning when there is no__get).Probed 2026-08-18 @
aa2e5e8b62— Zend 8.2.32 vsphp bin/vm.php/php bin/jit.php.$m->n++with__get/__setbackingn=>1inc=2, no warninginc=2+Undefined property: M::$n$m->n += 2on the same classplus=3, no warningplus=3, no warning (parity OK)php-src reference
Zend/zend_object_handlers.c—zend_std_read_property/zend_std_get_property_ptr_ptr/__get__setZend/zend_vm_def.h—ZEND_POST_INC_OBJPHP implementation target
lib/VM.php—warnUndefinedPropertyAfterIncDecRwFetch(Language: $obj->x++ omits Undefined property E_WARNING — Zend deprecates + warns (re-#29195, zend_object_handlers.c) #29241) must not fire when the class has__get(magic read supplies the value)lib/JIT.phpBP_VAR_RW undefined-property warn after create (~12934)runtime/*.cRepro
Done when
inc=2with noUndefined propertywarning (matches Zend).phptundertest/compliance/cases/language/