Category
Regression: · php-src-strict · SPL ArrayAccess null index = append
Problem
SplDoublyLinkedList::offsetSet(null, $value) (and $dll[] = $value / $dll[null] = $value) must append a new element (Zend). VM treats null as integer index 0 and overwrites the head — wrong length and wrong contents. Zend does not emit E_DEPRECATED for this null (append is intentional).
Related soft-null TypeErrors on offsetGet/offsetUnset/offsetExists/add(null) are siblings but distinct from this append rule.
Probed 2026-08-17 — host Zend PHP 8.2+ vs php bin/vm.php.
| Repro |
Zend 8.2+ |
VM (2026-08-17) |
push a,b then offsetSet(null, 'NEW') |
[0]=a [1]=b [2]=NEW count=3 |
[0]=NEW [1]=b count=2 |
php-src reference
PHP implementation target
ext/spl/ SplDoublyLinkedList::offsetSet — when $index === null, append (same as push); do not coerce null→0; PHP-in-PHP in ext/spl/, not new C runtime
Repro
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_dllist_offsetset_null_append.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_dllist_offsetset_null_append.php'
Done when
Category
Regression:· php-src-strict · SPL ArrayAccess null index = appendProblem
SplDoublyLinkedList::offsetSet(null, $value)(and$dll[] = $value/$dll[null] = $value) must append a new element (Zend). VM treatsnullas integer index0and overwrites the head — wrong length and wrong contents. Zend does not emitE_DEPRECATEDfor this null (append is intentional).Related soft-null TypeErrors on
offsetGet/offsetUnset/offsetExists/add(null)are siblings but distinct from this append rule.Probed 2026-08-17 — host Zend PHP 8.2+ vs
php bin/vm.php.a,bthenoffsetSet(null, 'NEW')[0]=a [1]=b [2]=NEWcount=3[0]=NEW [1]=bcount=2php-src reference
ext/spl/spl_dllist.c—spl_dllist_object_write_dimension/ null offset → pushext/spl/spl_dllist.stub.php—offsetSet(mixed $index, mixed $value)PHP implementation target
ext/spl/SplDoublyLinkedList::offsetSet— when$index === null, append (same aspush); do not coerce null→0; PHP-in-PHP inext/spl/, not new C runtimeRepro
Done when
offsetSet(null, …)appends on VM (count+1, value at end); dim-write$dll[]/$dll[null]agree.phptguard undertest/compliance/cases/