Skip to content

Commit

Permalink
Fix retrieval of deprecated error details
Browse files Browse the repository at this point in the history
The error_stack_trace() function contains logic to exclude the Error API
internal function calls. However, when it was introduced (see commit
295526c), the code processing
E_USER_DEPRECATED errors in error_handler() was not adapted.

This causes the error handler to throw 'Notice: Undefined offset' or
to return incorrect file and line number information

Fixes #25631
  • Loading branch information
dregad committed Mar 29, 2019
1 parent 16909b6 commit 11deb61
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions core/error_api.php
Expand Up @@ -231,15 +231,10 @@ function error_handler( $p_type, $p_error, $p_file, $p_line ) {
$t_error_type = 'DEBUG';
break;
case E_USER_DEPRECATED:
# Get the parent of the call that triggered the error to facilitate
# debugging with a more useful filename and line number
# Get details about the error, to facilitate debugging with a more
# useful message including filename and line number.
$t_stack = error_stack_trace();
if( isset( $t_stack[2] ) ) {
$t_caller = $t_stack[2];
} else {
# If called from main page body, there is no stack block for the function, use the page block instead
$t_caller = $t_stack[1];
}
$t_caller = $t_stack[0];

$t_error_type = 'WARNING';
$t_error_description = error_string( $p_error )
Expand Down

0 comments on commit 11deb61

Please sign in to comment.