Category
Language · php-src-strict / magic property decrement
Problem
--$obj->n and $obj->n-- when n is not a declared property and the class implements __get/__set must go through magic without Undefined property, same as post-increment (#31992). The VM calls __get/__set and the stored value matches Zend (dec=0 / postdec=0), but it emits Warning: Undefined property from the BP_VAR_RW inc/dec path.
Probed 2026-08-18 @ 524eece2a2 — Zend 8.2.32 vs php bin/vm.php.
| Repro |
Zend 8.2.32 |
VM |
--$m->n with __get/__set, n=>1 |
dec=0, no warning |
dec=0 + Undefined property: M::$n |
$m->n-- on same class |
postdec=0, no warning |
postdec=0 + Undefined property: M::$n |
$m->n++ (#31992) |
no warning |
warns (tracked separately) |
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_magic_prop_dec.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_magic_prop_postdec.php'
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_magic_prop_dec.php'
Done when
Category
Language· php-src-strict / magic property decrementProblem
--$obj->nand$obj->n--whennis not a declared property and the class implements__get/__setmust go through magic withoutUndefined property, same as post-increment (#31992). The VM calls__get/__setand the stored value matches Zend (dec=0/postdec=0), but it emitsWarning: Undefined propertyfrom the BP_VAR_RW inc/dec path.Probed 2026-08-18 @
524eece2a2— Zend 8.2.32 vsphp bin/vm.php.--$m->nwith__get/__set,n=>1dec=0, no warningdec=0+Undefined property: M::$n$m->n--on same classpostdec=0, no warningpostdec=0+Undefined property: M::$n$m->n++(#31992)php-src reference
Zend/zend_object_handlers.c— magic read/write for inc/decZend/zend_vm_def.h—ZEND_PRE_DEC_OBJ,ZEND_POST_DEC_OBJPHP implementation target
lib/VM.php— same guard as Language: $obj->n++ with __get/__set warns Undefined property — Zend silent magic (zend_object_handlers.c) #31992: skipwarnUndefinedPropertyAfterIncDecRwFetchwhen class has__getlib/JIT.php— BP_VAR_RW undefined-property warn on pre/post dec pathsruntime/*.cRepro
Done when
Undefined propertywarning; value matches Zend.phptundertest/compliance/cases/language/