You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I visit a page with [buggy_shortcode], it will throw an exception and Query Monitor will display a stack trace, as expected, but if I look in the error log I see some additional notices (note that I have WP_DEBUG set to true):
PHP Notice: Undefined index: file in .../query-monitor/collectors/php_errors.php on line 364
...
PHP Notice: Undefined index: line in .../query-monitor/collectors/php_errors.php on line 364
If you look at the stack trace itself you can see the problem:
Here do_shortcode() calls preg_replace_callback(), which calls do_shortcode_tag() as its callback. Therefore, do_shortcode_tag() is not being called from PHP code - it is being called from the PHP interpreter itself, so there is no .php file and line number. As a result, the stack trace is missing 'file' and 'line' elements.
This behavior does not appear to be explicitly documented anywhere, although it seems it is hinted at in https://www.php.net/manual/en/function.debug-backtrace.php where it says, "The possible [my emphasis] returned elements are as follows ... " - which suggests that the elements may or may not be present.
The text was updated successfully, but these errors were encountered:
Consider the following shortcode:
If I visit a page with
[buggy_shortcode]
, it will throw an exception and Query Monitor will display a stack trace, as expected, but if I look in the error log I see some additional notices (note that I haveWP_DEBUG
set totrue
):If you look at the stack trace itself you can see the problem:
Here
do_shortcode()
callspreg_replace_callback()
, which callsdo_shortcode_tag()
as its callback. Therefore,do_shortcode_tag()
is not being called from PHP code - it is being called from the PHP interpreter itself, so there is no.php
file and line number. As a result, the stack trace is missing'file'
and'line'
elements.This behavior does not appear to be explicitly documented anywhere, although it seems it is hinted at in https://www.php.net/manual/en/function.debug-backtrace.php where it says, "The possible [my emphasis] returned elements are as follows ... " - which suggests that the elements may or may not be present.
The text was updated successfully, but these errors were encountered: