From bd1d11d352ddfb2c376060d7e7b282636dce1605 Mon Sep 17 00:00:00 2001 From: twosee Date: Thu, 10 Sep 2020 17:36:04 +0800 Subject: Simplify error type filter Closes GH-6049. --- sapi/phpdbg/phpdbg.c | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'sapi/phpdbg/phpdbg.c') diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index d817349941..4629f94986 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -798,32 +798,25 @@ static void php_sapi_phpdbg_log_message(const char *message, int syslog_type_int return; } - switch (PG(last_error_type)) { - case E_ERROR: - case E_CORE_ERROR: - case E_COMPILE_ERROR: - case E_USER_ERROR: - case E_PARSE: - case E_RECOVERABLE_ERROR: { - const char *file_char = zend_get_executed_filename(); - zend_string *file = zend_string_init(file_char, strlen(file_char), 0); - phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno()); - zend_string_release(file); - - if (!phpdbg_fully_started) { - return; - } - - do { - switch (phpdbg_interactive(1, NULL)) { - case PHPDBG_LEAVE: - case PHPDBG_FINISH: - case PHPDBG_UNTIL: - case PHPDBG_NEXT: - return; - } - } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)); + if (PG(last_error_type) & E_FATAL_ERRORS) { + const char *file_char = zend_get_executed_filename(); + zend_string *file = zend_string_init(file_char, strlen(file_char), 0); + phpdbg_list_file(file, 3, zend_get_executed_lineno() - 1, zend_get_executed_lineno()); + zend_string_release(file); + + if (!phpdbg_fully_started) { + return; } + + do { + switch (phpdbg_interactive(1, NULL)) { + case PHPDBG_LEAVE: + case PHPDBG_FINISH: + case PHPDBG_UNTIL: + case PHPDBG_NEXT: + return; + } + } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)); } } else { fprintf(stdout, "%s\n", message); -- cgit v1.2.1