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/cli/php_cli_server.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'sapi/cli') 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; } } -- cgit v1.2.1