Skip to content

Fix GH-22849: error_include_args=1 mishandled for include()#22851

Open
NattyNarwhal wants to merge 1 commit into
php:masterfrom
NattyNarwhal:gh22849
Open

Fix GH-22849: error_include_args=1 mishandled for include()#22851
NattyNarwhal wants to merge 1 commit into
php:masterfrom
NattyNarwhal:gh22849

Conversation

@NattyNarwhal

Copy link
Copy Markdown
Member

include and friends aren't functions, but constructs of the engine. Special-case them and snarf their argument for display.

Not sure if this is the best way to handle it (or if we'd also need to special-case other opcodes here too)

include and friends aren't functions, but constructs of the engine.
Special-case them and snarf their argument for display.

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is fine.

I was confused why this didn't work backtraces can include requires and includes, but I think the reason why fetching the arguments for include/require doesn't work via the backtrace is that zend_fetch_debug_backtrace() assumes it cannot be called during a require/include/eval "call" and so the first frame is never checked to be an opcode.

@NattyNarwhal

Copy link
Copy Markdown
Member Author

Yeah, I noticed the special-casing as well with the inserting of fake frames, but it assumes it would never be the top frame.

@NattyNarwhal

Copy link
Copy Markdown
Member Author

I think the other (maybe better?) approach would be to insert a top-level fake frame for include events, but the logic in zend_fetch_debug_backtrace is a little hairy to follow. I also don't think it would disrupt much, because the only situation it should trigger is this.

@NattyNarwhal
NattyNarwhal marked this pull request as ready for review July 21, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants