Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Proper processing of unhandled errors
Sometimes the execution of a test itself can trigger an error, and in
some cases the test can be successful despite of that (e.g. a PHP notice
or use of deprecated functionality). The code was not handling these
situations properly when $g_show_all = true, causing the test to
continue silently instead of reporting the problem.

Added a case for E_DEPRECATED and clarified description for unhandled
error types in check_print_error_rows(). Also made sure the error is
properly captured  when hiding passed tests and/or verbose error
messages are not shown.

Fixes #16890
  • Loading branch information
dregad committed Feb 4, 2014
1 parent cad58df commit 323deb3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions admin/check/check_api.php
Expand Up @@ -92,6 +92,10 @@ function check_print_error_rows() {
$t_error_type = 'SYSTEM NOTICE';
$t_error_description = htmlentities( $t_error['error'] );
break;
case E_DEPRECATED:
$t_error_type = 'DEPRECATED';
$t_error_description = htmlentities( $t_error['error'] );
break;
case E_USER_ERROR:
$t_error_type = 'APPLICATION ERROR #' . $t_error['error'];
$t_error_description = htmlentities( error_string( $t_error['error'] ) );
Expand All @@ -106,8 +110,8 @@ function check_print_error_rows() {
$t_error_description = htmlentities( $t_error['error'] );
break;
default:
# shouldn't happen, just display the error just in case
$t_error_type = '';
# shouldn't happen, display the error just in case
$t_error_type = 'UNHANDLED ERROR TYPE ' . $t_error['type'];
$t_error_description = htmlentities( $t_error['error'] );
}
echo "\t<tr>\n\t\t<td colspan=\"2\" class=\"error\">";
Expand Down Expand Up @@ -177,9 +181,11 @@ function check_print_test_result( $p_result ) {
*/
function check_print_test_row( $p_description, $p_pass, $p_info = null ) {
global $g_alternate_row, $g_show_all;
if ( !$g_show_all && $p_pass ) {
$t_unhandled = check_unhandled_errors_exist();
if ( !$g_show_all && $p_pass && !$t_unhandled) {
return $p_pass;
}

echo "\t<tr>\n\t\t<td class=\"description$g_alternate_row\">$p_description";
if( $p_info !== null) {
if( is_array( $p_info ) && isset( $p_info[$p_pass] ) ) {
Expand Down Expand Up @@ -211,7 +217,8 @@ function check_print_test_row( $p_description, $p_pass, $p_info = null ) {
*/
function check_print_test_warn_row( $p_description, $p_pass, $p_info = null ) {
global $g_alternate_row, $g_show_all;
if ( !$g_show_all && $p_pass ) {
$t_unhandled = check_unhandled_errors_exist();
if ( !$g_show_all && $p_pass && !$t_unhandled) {
return $p_pass;
}
echo "\t<tr>\n\t\t<td class=\"description$g_alternate_row\">$p_description";
Expand Down

0 comments on commit 323deb3

Please sign in to comment.