Skip to content

Language: keyed list destructure Undefined array key Warning cites previous line — Zend list site (zend_vm_def.h) #31994

Description

@PurHur

Category

Language · php-src-strict / list destructure warning line

Problem

Keyed list / short-array destructure of a missing key correctly emits Undefined array key and assigns null, but the warning line is the previous statement, not the destructure. Positional [$a, $b] = [1] already cites the list line (parity OK).

Probed 2026-08-18 @ aa2e5e8b62 — Zend 8.2.32 vs php bin/vm.php / php bin/jit.php.

Repro Zend 8.2.32 VM / JIT
[$a, $b] = [1]; (file line 3) Warning key 1 line 3 line 3 (parity OK)
['x' => $c] = ['y' => 1]; (file line 5) Warning key "x" line 5 Warning key "x" line 4 (the echo above)

php-src reference

PHP implementation target

  • lib/Compiler.php — list/keyed-destructure fetch opcodes must keep the destructure source line (not the previous stmt)
  • lib/VM.php / lib/VM/ErrorReporter.phpundefinedArrayKey already has the right text; pass the list site
  • JIT: same lineno on the fetch
  • No new runtime/*.c

Repro

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

Done when

  • VM warning for key "x" cites line 5 of the repro (matches Zend); key 1 stays line 3
  • JIT/AOT same (or documented skip with reason)
  • 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