<?php
[$a, $b] = null;
echo "a=", var_export($a, true), " b=", var_export($b, true), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
[\$a,\$b]=null;
echo \"a=\",var_export(\$a,true),\" b=\",var_export(\$b,true),\"\\n\";
"'
Category
languageProblem
When the RHS of list destructuring is
null(or other non-array/non-iterable scalars), Zend does not assign the list slots — variables stay unset (nullon read). This compiler may still runArrayDimFetchwith literal keys0,1, … against a null/scalar container, producing notices or wrong values.Related but distinct:
['a' => $x]php-src reference
Zend/zend_execute.c— list assignment on non-array typesZend/zend_operators.c— destructuring source type checksRepro (today)
a=NULL b=NULL(both unset → null)bin/vm.phpAlso verify
list($x) = false;and[$x] = 0;match Zend (no assignment).Scope
lib/Compiler.php— list-assign lowering afterparseListAssignmenttest/compliance/cases/language/list_destructure_null.phptDone when
null,false,0) match Zend unset/null output on VM./script/ci-fast.sh --filter list_destructure_nullgreenLinks