Skip to content

Regression: SplDoublyLinkedList::add(null) TypeError — Zend E_DEPRECATED soft coerce (ext/spl/spl_dllist.c) #31803

Description

@PurHur

Category

Regression: · php-src-strict · SPL soft-null

Problem

SplDoublyLinkedList::add(null, $v) under non-strict types must emit E_DEPRECATED ("Passing null to parameter #1 ($index) of type int is deprecated") and insert at index 0. VM throws TypeError.

Sibling: offsetSet(null) already appends without DEP (#31731); add uses Z_PARAM_LONG and soft-deprecates.

Probed 2026-08-17 — host Zend PHP 8.2+ vs php bin/vm.php.

Repro Zend 8.2+ VM (2026-08-17)
$l->add(null, 'x') after one push E_DEPRECATED + insert at 0 TypeError Argument #1 ($index)

php-src reference

PHP implementation target

  • ext/spl/SplDoublyLinkedListBuiltin.php — soft-null via VmMath::parseZParamLongBuiltinArgForFrame (or shared coerceIndex DEP path)

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_dllist_add_null.php'

Done when

  • VM (+ JIT when covered) emits E_DEPRECATED #1 ($index) and inserts at 0
  • Unit/repro guard; 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:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions