Category
Language · php-src-strict / encapsed-string diagnostics
Problem
Undefined-variable warnings raised while compiling encapsed string fetches (double-quoted, ${var}, heredoc) cite the opening statement line (often error_reporting(E_ALL) on line 2) instead of the expression site Zend reports.
Probed 2026-08-18 @ 5243c6f5e5 — Zend 8.2.32 vs php bin/vm.php / php bin/jit.php.
| Repro |
Zend 8.2.32 |
VM/JIT |
echo "x=$missing\n" |
Warning on line 3 |
Warning on line 2 |
$s = "a$missing b" |
line 3 |
line 2 |
$s = "a{$missing} b" |
line 3 |
line 2 |
echo "${missing}\n" |
line 3 |
line 2 |
heredoc with $missing |
line 4 |
line 2 |
echo $missing (plain) |
line 3 |
line 3 ✓ |
Bare variable reads, assigns, and calls report the correct line; only encapsed fetch paths are off.
php-src reference
PHP implementation target
lib/Compiler.php — encapsed-string / rope lowering: propagate user start line for embedded variable fetches
lib/VM.php — if warnings are emitted from compile-time rope setup, move to runtime fetch with correct opline or fix line on the emitted warn opcode
- No new
runtime/*.c
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_undef_var_line.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_undef_var_encapsed_line.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_undef_var_heredoc_line.php'
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_undef_var_line.php' # Zend baseline
Done when
Category
Language· php-src-strict / encapsed-string diagnosticsProblem
Undefined-variable warnings raised while compiling encapsed string fetches (double-quoted,
${var}, heredoc) cite the opening statement line (oftenerror_reporting(E_ALL)on line 2) instead of the expression site Zend reports.Probed 2026-08-18 @
5243c6f5e5— Zend 8.2.32 vsphp bin/vm.php/php bin/jit.php.echo "x=$missing\n"$s = "a$missing b"$s = "a{$missing} b"echo "${missing}\n"$missingecho $missing(plain)Bare variable reads, assigns, and calls report the correct line; only encapsed fetch paths are off.
php-src reference
Zend/zend_compile.c—zend_compile_encapsed_string,FETCH_DIM_R/FETCH_Rline info for warningsZend/zend_execute.c—ZEND_SEND_VARIABLE/ZEND_ROPE_*warning sitesPHP implementation target
lib/Compiler.php— encapsed-string / rope lowering: propagate user start line for embedded variable fetcheslib/VM.php— if warnings are emitted from compile-time rope setup, move to runtime fetch with correctoplineor fix line on the emitted warn opcoderuntime/*.cRepro
Done when
$undefinedwarnings cite the same line as Zend for double-quoted, brace,${}, and heredoc forms$undefined/ undefined array-key echo unchanged (already green).phptundertest/compliance/cases/language/