Skip to content

Language: nested-frame warnings cite inner opline not call site (#32040) - #32066

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-32040-nested-warn-line
Aug 18, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-32040-nested-warn-line

Conversation

@PurHur

@PurHur PurHur commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Warnings and deprecations raised inside a user function, method, or closure cited the call site instead of the inner opcode line Zend reports (EG(current_execute_data)->opline).
  • ErrorReporter::resolveDisplayLocation() walked parent callSiteLine before the current frame's opline. Prefer this frame's pending FUNCCALL line, else FatalSite::lineFromOpcodes(), then parent (builtins still attribute to the user call, Runtime: set_error_handler() callbacks receive empty $file and line 0 — Zend passes trigger site (Zend/zend_execute.c) #11163).
  • php-src: Zend/zend_execute.c, Zend/zend_errors.c, Zend/zend_operators.c (mod_function E_DEPRECATED). PHP implementation: lib/VM/ErrorReporter.php.

Closes #32040

Test plan

  • Issue repros (VM + JIT) match Zend 8.2.32 inner lines
  • ./script/phpunit.sh --filter 'UndefinedVariableWarningLineTest|NestedFrameWarningLine32040|EncapsedUndefVarWarningLine32034' — OK (12 tests)
  • Builtin chr(1.5) inside a function still cites the chr() line (call-site-of-builtin, not caller of the user function)

Verification

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_undef_var_function_line.php'
# PHP Warning: ... on line 6   (was 9; Zend line 6)

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_undef_var_method_line.php'
# PHP Warning: ... on line 8   (was 12; Zend line 8)

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_mod_float_closure_line.php'
# PHP Deprecated: ... on line 5   (was 7; Zend line 5)

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_mod_float_file_scope_line.php'
# PHP Deprecated: ... on line 4   (unchanged, Zend line 4)

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_undef_var_closure_error_get_last.php'
# Warning on line 4; last:4   (was call site)

./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_undef_var_function_line.php'
# PHP Warning: ... on line 6

./script/phpunit.sh --filter 'UndefinedVariableWarningLineTest|NestedFrameWarningLine32040|EncapsedUndefVarWarningLine32034'
# OK (12 tests, 40 assertions)

php-src-strict. No new runtime/*.c. Lane overflow from worker-lane-C (lane C IR was stdlib/ext-owned).

Not covered: full VMTest/JITTest suites, script/differential-sweep.sh, AOT native emit of these repros.

Made with Cursor

ErrorReporter walked parent callSiteLine before the current opcode, so
undefined-variable and float-mod deprecations inside functions/methods/closures
cited the caller. Prefer this frame's opline, matching Zend execute_data.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 21819ee into master Aug 18, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-32040-nested-warn-line branch August 18, 2026 04:44
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: warnings inside functions/methods/closures cite call site — Zend inner opline (Zend/zend_execute.c)

1 participant