Skip to content

Language: encapsed Undefined variable Warning cites user site (#32034) - #32059

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-32034-encapsed-undef-line
Aug 18, 2026
Merged

Language: encapsed Undefined variable Warning cites user site (#32034)#32059
PurHur merged 1 commit into
masterfrom
agent/issue-32034-encapsed-undef-line

Conversation

@PurHur

@PurHur PurHur commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Encapsed/heredoc $undefined warnings cited the previous statement (often error_reporting on line 2) because ConcatList CONCAT/CAST_STRING opcodes had no sourceLocation.
  • Stamp those opcodes from the ConcatList user site (heredoc: first body line, php-parser KIND_HEREDOC) and advance JIT callSiteLine from opcode sourceLocation.
  • php-src: Zend/zend_compile.c zend_compile_encapsed_string FETCH_R lineno. PHP: lib/Compiler.php ConcatList lowering + lib/JIT.php opline stamp.

Closes #32034

Test plan

  • Issue repros vs Zend 8.2.32 (VM + JIT)
  • ./script/phpunit.sh --filter EncapsedUndefVarWarningLine32034
  • Nearby warning-line / encapsed tests (ListDestructUndefKeyLine31994, ForeachScalarWarningLine, EncapsedCoalesce)
  • Full VMTest / JITTest not run (path-slash --filter on those suites is known-broken; dedicated providers cover this case)

Verification

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

VM (matches Zend): warnings on lines 3, 4, 5, 6 (was 2, 3, 3, 3).

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

VM (matches Zend): warning on line 4 (was 2).

./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_undef_var_encapsed_line.php'
./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_undef_var_heredoc_line.php'

JIT same lines as Zend.

./script/phpunit.sh --filter EncapsedUndefVarWarningLine32034

OK (VM + JIT dedicated PHPT).

php-src-strict; no php-compiler-strict shortcut. No new runtime/*.c.

Made with Cursor

Stamp ConcatList CONCAT/CAST_STRING with the interpolated expression line so
VM/JIT FETCH_R warnings match Zend instead of the prior statement opline.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 9ba894f into master Aug 18, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-32034-encapsed-undef-line branch August 18, 2026 04:36
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: encapsed Undefined variable Warning cites wrong line — Zend user site (Zend/zend_compile.c)

1 participant