From 276c031012c52f6f7dac83e0c793cc6362301b60 Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Tue, 6 Feb 2018 23:35:52 +0100 Subject: [PATCH] Remove error handler's "errcontext" parameter The $errcontext parameter for the error handler function has been deprecated in PHP 7.2. We currently use this parameter to display some of the local variables when an error is triggered and $g_show_detailed_errors = ON, but the output is broken and difficult to read since 2.x was released. Considering the deprecation notice, it does not make sense to fix the layout now since the raw data will no longer be available in the next major PHP release. This commit changes the error handler's signature, and removes all code dedicated to printing Context information on the detailed error page. Fixes #23942 --- core/error_api.php | 54 ++++------------------------------------------ 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/core/error_api.php b/core/error_api.php index 2aa8e25abd..dcc69fbb35 100644 --- a/core/error_api.php +++ b/core/error_api.php @@ -130,7 +130,6 @@ function error_stack_trace( $p_exception = null ) { * @param string $p_error Contains the error message, as a string. * @param string $p_file Contains the filename that the error was raised in, as a string. * @param integer $p_line Contains the line number the error was raised at, as an integer. - * @param array $p_context To the active symbol table at the point the error occurred (optional). * @return void * @uses lang_api.php * @uses config_api.php @@ -138,7 +137,7 @@ function error_stack_trace( $p_exception = null ) { * @uses database_api.php (optional) * @uses html_api.php (optional) */ -function error_handler( $p_type, $p_error, $p_file, $p_line, array $p_context ) { +function error_handler( $p_type, $p_error, $p_file, $p_line ) { global $g_error_parameters, $g_error_handled, $g_error_proceed_url; global $g_error_send_page_header; @@ -352,7 +351,7 @@ function error_handler( $p_type, $p_error, $p_file, $p_line, array $p_context ) echo '', "\n"; if( $t_show_detailed_errors ) { - error_print_details( $p_file, $p_line, $p_context ); + error_print_details( $p_file, $p_line ); error_print_stack_trace(); } echo ''; @@ -426,13 +425,12 @@ function error_print_delayed() { } /** - * Print out the error details including context + * Print out the error details * @param string $p_file File error occurred in. * @param integer $p_line Line number error occurred on. - * @param array $p_context Error context. * @return void */ -function error_print_details( $p_file, $p_line, array $p_context ) { +function error_print_details( $p_file, $p_line ) { ?>

@@ -447,54 +445,10 @@ function error_print_details( $p_file, $p_line, array $p_context ) { - -

Context

-
VariableValueType'; - - # print normal variables - foreach( $p_context as $t_var => $t_val ) { - if( !is_array( $t_val ) && !is_object( $t_val ) ) { - $t_type = gettype( $t_val ); - $t_val = htmlentities( (string)$t_val, ENT_COMPAT, 'UTF-8' ); - - # Mask Passwords - if( strpos( $t_var, 'password' ) !== false ) { - $t_val = '**********'; - } - - echo '', $t_var, - '', $t_val, - '', $t_type, '', "\n"; - } - } - - # print arrays - foreach( $p_context as $t_var => $t_val ) { - if( is_array( $t_val ) && ( $t_var != 'GLOBALS' ) ) { - echo '
', $t_var, ''; - echo ''; - error_print_context( $t_val ); - echo ''; - } - } - - echo ''; -} /** * Get the stack trace as a string that can be logged or echoed to CLI output.