Skip to content

Fix GH-25971: Format include and require in stack traces - #25981

Open
jlu-lujing wants to merge 1 commit into
php:PHP-8.4from
jlu-lujing:gh-25971-include-stack-trace
Open

jlu-lujing wants to merge 1 commit into
php:PHP-8.4from
jlu-lujing:gh-25971-include-stack-trace

Conversation

@jlu-lujing

Copy link
Copy Markdown

include, include_once, require, and require_once are language constructs, but exception stack traces format their frames like function calls. This changes the trace rendering to use the language-construct form, for example include '/path', while retaining the existing format for functions, methods, and eval().

Argument-free frames remain include/require without parentheses or trailing whitespace. Existing trace tests whose expected output changes have been updated, and a focused regression test was added.

Tests:

  • New test fails before the change and passes after it.
  • Zend/tests: 4,936 passed, 148 skipped due to extensions omitted from the minimal build, 0 failed.
  • Affected CLI server, language, type-declaration, and trace tests pass.

OpenAI Codex assisted with investigating the trace formatter, preparing the focused code and regression changes, and drafting this description. I reviewed and verified the resulting change locally.

Include and require are language constructs, but stack traces formatted them like function calls. Render them without parentheses while preserving the existing function-call format and handling argument-free frames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant