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
This commit adds an INI setting, 'error_backtrace_recording', which
users can set to an error mask to enable backtraces for those errors.
It defaults to E_FATAL_ERRORS, meaning that any non-recoverable error
will now have a backtrace associated with it. For example, a script
timeout will now look like:
Fatal error: Maximum execution time of 1 second exceeded in example.php on line 23
Stack trace:
#0 example.php(23): usleep(10000)
php#1 example.php(24): recurse()
php#2 example.php(24): recurse()
...
It respects the `zend.exception_ignore_args` INI setting and the
SensitiveParameter attributes, so users can ensure that sensitive
arguments do not end up in the backtrace.
if (PG(display_errors) && ((module_initialized&& !PG(during_request_startup)) || (PG(display_startup_errors)))) {
1398
1403
if (PG(xmlrpc_errors)) {
1399
-
php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>"ZEND_LONG_FMT"</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %"PRIu32"</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, ZSTR_VAL(message), ZSTR_VAL(error_filename), error_lineno);
1404
+
php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>"ZEND_LONG_FMT"</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %"PRIu32"%s%s</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, ZSTR_VAL(message), ZSTR_VAL(error_filename), error_lineno, ZSTR_LEN(backtrace) ? "\nStack trace:\n" : "", ZSTR_VAL(backtrace));
php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%"PRIu32"</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, ZSTR_VAL(buf), ZSTR_VAL(error_filename), error_lineno, STR_PRINT(append_string));
1408
1413
zend_string_free(buf);
1409
1414
} else {
1410
-
php_printf_unchecked("%s<br />\n<b>%s</b>: %S in <b>%s</b> on line <b>%"PRIu32"</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, message, ZSTR_VAL(error_filename), error_lineno, STR_PRINT(append_string));
1415
+
php_printf_unchecked("%s<br />\n<b>%s</b>: %S in <b>%s</b> on line <b>%"PRIu32"</b><br />%s%s\n%s", STR_PRINT(prepend_string), error_type_str, message, ZSTR_VAL(error_filename), error_lineno, ZSTR_LEN(backtrace) ? "\nStack trace:\n" : "", ZSTR_VAL(backtrace), STR_PRINT(append_string));
1411
1416
}
1412
1417
} else {
1413
1418
/* Write CLI/CGI errors to stderr if display_errors = "stderr" */
fprintf(stderr, " in %s on line %"PRIu32"\n", ZSTR_VAL(error_filename), error_lineno);
1424
+
fprintf(stderr, " in %s on line %"PRIu32"%s%s\n", ZSTR_VAL(error_filename), error_lineno, ZSTR_LEN(backtrace) ? "\nStack trace:\n" : "", ZSTR_VAL(backtrace));
1420
1425
#ifdefPHP_WIN32
1421
1426
fflush(stderr);
1422
1427
#endif
1423
1428
} else {
1424
-
php_printf_unchecked("%s\n%s: %S in %s on line %"PRIu32"\n%s", STR_PRINT(prepend_string), error_type_str, message, ZSTR_VAL(error_filename), error_lineno, STR_PRINT(append_string));
1429
+
php_printf_unchecked("%s\n%s: %S in %s on line %"PRIu32"%s%s\n%s", STR_PRINT(prepend_string), error_type_str, message, ZSTR_VAL(error_filename), error_lineno, ZSTR_LEN(backtrace) ? "\nStack trace:\n" : "", ZSTR_VAL(backtrace), STR_PRINT(append_string));
0 commit comments