Skip to content

Language: $obj->n-- / --$obj->n with __get/__set warns Undefined property — Zend silent magic (re-#31992, zend_object_handlers.c) #32014

Description

@PurHur

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

  • VM/JIT/AOT: pre/post dec on magic-backed property — no Undefined property warning; value matches Zend
  • Compliance .phpt under test/compliance/cases/language/
  • php-src-strict; no php-compiler-strict shortcut

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITarea:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions