summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authortwosee <twose@qq.com>2020-09-10 17:36:04 +0800
committertwosee <twose@qq.com>2020-09-10 17:36:04 +0800
commitbd1d11d352ddfb2c376060d7e7b282636dce1605 (patch)
treea9d958862030ba3f5f3758fd05e3c1bc9ab5c21f /sapi
parent298d2db62e9e9c13edc495a49cde2a928f8e4a5b (diff)
downloadphp-git-bd1d11d352ddfb2c376060d7e7b282636dce1605.tar.gz
Simplify error type filter
Closes GH-6049.
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cli/php_cli_server.c18
-rw-r--r--sapi/phpdbg/phpdbg.c43
2 files changed, 24 insertions, 37 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 64e29e8524..337886bcd3 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1177,19 +1177,13 @@ static void php_cli_server_log_response(php_cli_server_client *client, int statu
zend_bool append_error_message = 0;
if (PG(last_error_message)) {
- switch (PG(last_error_type)) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- case E_PARSE:
- if (status == 200) {
- /* the status code isn't changed by a fatal error, so fake it */
- effective_status = 500;
- }
+ if (PG(last_error_type) & E_FATAL_ERRORS) {
+ if (status == 200) {
+ /* the status code isn't changed by a fatal error, so fake it */
+ effective_status = 500;
+ }
- append_error_message = 1;
- break;
+ append_error_message = 1;
}
}
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);