Skip to content

Language: emit Undefined array key Warning on dim ++/-- (#30078) - #30158

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-30078-dim-inc-undef-key-warning
Aug 11, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-30078-dim-inc-undef-key-warning

Conversation

@PurHur

@PurHur PurHur commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

Verification

Issue repro (VM + JIT, PHP_COMPILER_PROFILE=8.4):

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
export PHP_COMPILER_PROFILE=8.4
printf "%s\n" "<?php
\$x=[]; \$x[0]++; echo \"done\n\"; var_export(\$x); echo PHP_EOL;
\$f=false; \$f[0]++; var_export(\$f); echo PHP_EOL;
" >/tmp/dim_inc_undef.php
php -d error_reporting=E_ALL -d display_errors=1 bin/vm.php /tmp/dim_inc_undef.php
php -d error_reporting=E_ALL -d display_errors=1 bin/jit.php /tmp/dim_inc_undef.php
'

Output (both backends):

W:Undefined array key 0
done
array ( 0 => 1, )
W:Automatic conversion of false to array is deprecated
W:Undefined array key 0
array ( 0 => 1, )

Not covered

  • Full VMTest/JITTest shards; bootstrap/self-host gates (language-only VM/JIT change).

Closes #30078

Made with Cursor

Zend warns when incrementing/decrementing a missing array key before
coercing null and storing the result. Match that for VM FETCH_DIM_W
followed by inc/dec and JIT dimFetch write paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit b059579 into master Aug 11, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-30078-dim-inc-undef-key-warning branch August 11, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: $a[missing]++ omits Undefined array key Warning — Zend warns then treats as null (zend_execute.c)

1 participant