Fix GH-22849: error_include_args=1 mishandled for include()#22851
Fix GH-22849: error_include_args=1 mishandled for include()#22851NattyNarwhal wants to merge 1 commit into
Conversation
include and friends aren't functions, but constructs of the engine. Special-case them and snarf their argument for display.
Girgias
left a comment
There was a problem hiding this comment.
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.
|
Yeah, I noticed the special-casing as well with the inserting of fake frames, but it assumes it would never be the top frame. |
|
I think the other (maybe better?) approach would be to insert a top-level fake frame for include events, but the logic in |
| <?php | ||
|
|
||
| function foo() { | ||
| eval('include("does not exist");'); |
There was a problem hiding this comment.
Not sure how much value this line provides, since it's not eval() itself that emits the warning.
| dynamic_params = smart_str_extract(&str); | ||
| return dynamic_params; |
There was a problem hiding this comment.
| dynamic_params = smart_str_extract(&str); | |
| return dynamic_params; | |
| return smart_str_extract(&str); |
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)