Repository navigation
Regression: unset($obj->arr[$k]) no-ops again on instance/static array props — Zend removes (re-#24250, zend_execute.c) #31818
Description
Category
Regression: · php-src-strict · language (UNSET_DIM on object / static properties)
Problem
unset($obj->prop[$key]) / unset($this->prop[$key]) / unset(Class::$prop[$key]) must remove the array key on instance and static object properties (typed and untyped). After #24250 / #24263 this was green; on master 2026-08-17 it is a no-op again (likely regressed by recent typed-property dim work around #31770–#31784).
Userland ArrayAccess::offsetUnset that does unset($this->storage[$offset]) on a private/typed array property is broken the same way — isset($obj[$k]) stays true after unset($obj[$k]) even though offsetUnset runs.
Local $a[$k] unset still matches Zend (control).
Probed 2026-08-17 — host Zend PHP 8.2 vs php bin/vm.php.
| Repro | Zend 8.2+ | VM (2026-08-17) |
|---|---|---|
unset($c->t['y']) public array |
key gone | key remains |
unset($this->pt['a']) private array |
key gone | key remains |
unset($c->u['q']) public untyped |
key gone | key remains |
unset(StaticBag::$t['y']) |
key gone | key remains |
ArrayAccess unset($s['k']) → unset($this->d[$k]) |
isset false |
isset true |
unset($local[1]) |
key gone | key gone (match) |
UnsetComplianceTest / unset_object_array_dim.phpt fails: expected t=0 pt=0 u=0 pu=0 / aa=00, actual t=2 pt=1 u=2 pu=1 / aa=11.
php-src reference
- php/php-src
Zend/zend_execute.c—ZEND_UNSET_DIM/ property fetch + dim unset must mutate live array storage - php/php-src
Zend/zend_object_handlers.c— property ptr for unset - Prior fix: Regression: unset($obj->arr[$k]) no-ops on typed/private instance array props — Zend removes (Zend/zend_execute.c) #24250 / Language: persist unset($obj->arr[$k]) into instance properties (#24250) #24263 (R-mode alias for following
TYPE_UNSET)
PHP implementation target
lib/VM.php/ unset-dim lowering — property dim unset must write back (same class of fix as Language: persist unset($obj->arr[$k]) into instance properties (#24250) #24263); do not regress Language: dim-assign/append on uninitialized typed array property Errors — Zend auto-inits [] (zend_object_handlers.c) #31770 array auto-init on assignlib/Compiler.php/lib/JIT/if UNSET_DIM is lowered separately- php-in-PHP — no new C runtime branch
Repro
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_unset_object_array_dim.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_unset_object_array_dim.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_unset_object_array_dim_static.php'
./script/phpunit.sh --filter UnsetComplianceTestDone when
- Instance + static
unset($obj->arr[$k])removes the key (typed/untyped, public/private) matching Zend - ArrayAccess
unset($obj[$k])that unsets a property dim leavesissetfalse -
UnsetComplianceTest/unset_object_array_dim.phptgreen - Local
unset($a[$k])and Language: dim-assign/append on uninitialized typed array property Errors — Zend auto-inits [] (zend_object_handlers.c) #31770 dim-assign auto-init for typedarraystill green - php-src-strict; no php-compiler-strict shortcut
Activity
PurHur commentedon Aug 17, 2026
claim: Worker lane C — starting this run (lane overflow: no eligible IR in lane C; #31817 claimed by PHP Runtime → PHP; stdlib/ext-owned queue skipped)
Language: restore unset($obj->arr[$k]) mutating instance/static props (…
PurHur commentedon Aug 17, 2026
Merged #31825
Cause: #31783 marked PropertyFetch before dim unset as
propertyHookCoalesceRead(FETCH_OBJ_IS), so unsets copied the array and no-op’d on the property.Fix: IS-mode prelude only for isset/empty/??; unset keeps R-mode live alias.
Verified (after rebase on master):
php bin/vm.php test/repro/maintainer_gap_unset_object_array_dim.php— empty arraysphp bin/vm.php test/repro/maintainer_gap_unset_object_array_dim_static.php— keys removed,aa=0./script/phpunit.sh --filter UnsetComplianceTest— OK (9)Language: restore unset($obj->arr[$k]) mutating instance/static props (…