From b877733efc87dfc5bd138d43f3581ffcceb54c33 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 8 Jun 2020 12:37:52 +0200 Subject: [PATCH 1/4] Fix incorrect usage of zend_bool in Zend globals --- Zend/zend_globals.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 60d32c0335e32..049800a32d414 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -81,7 +81,8 @@ struct _zend_compiler_globals { HashTable *auto_globals; - zend_bool parse_error; + /* Refer to zend_yytnamerr() in zend_language_parser.y for meaning of values */ + zend_uchar parse_error; zend_bool in_compilation; zend_bool short_tags; From ec93c57141fddc0e1e6e0b5514e90f083ce35245 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 8 Jun 2020 15:05:58 +0200 Subject: [PATCH 2/4] Fix incorrect zend_bool usage for display_errors --- main/main.c | 7 ++++--- main/php_globals.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main/main.c b/main/main.c index 119fbb26dfda3..4404fc52860b8 100644 --- a/main/main.c +++ b/main/main.c @@ -447,9 +447,9 @@ static PHP_INI_MH(OnUpdateTimeout) /* {{{ php_get_display_errors_mode() helper function */ -static int php_get_display_errors_mode(char *value, size_t value_length) +static zend_uchar php_get_display_errors_mode(char *value, size_t value_length) { - int mode; + zend_uchar mode; if (!value) { return PHP_DISPLAY_ERRORS_STDOUT; @@ -490,7 +490,8 @@ static PHP_INI_MH(OnUpdateDisplayErrors) */ static PHP_INI_DISP(display_errors_mode) { - int mode, cgi_or_cli; + zend_uchar mode; + bool cgi_or_cli; size_t tmp_value_length; char *tmp_value; diff --git a/main/php_globals.h b/main/php_globals.h index 3f34aac951d6c..42337e5b9bd10 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -65,7 +65,7 @@ struct _php_core_globals { zend_long memory_limit; zend_long max_input_time; - zend_bool display_errors; + zend_uchar display_errors; zend_bool display_startup_errors; zend_bool log_errors; zend_long log_errors_max_len; From f6133b17be2541c86236e8ca2b3b6d875992acb8 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Mon, 8 Jun 2020 12:40:29 +0200 Subject: [PATCH 3/4] Use standard boolean type as zend_bool typedef --- Zend/zend_types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 026177cf17ffa..52997488736f8 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -24,6 +24,7 @@ #include "zend_portability.h" #include "zend_long.h" +#include #ifdef __SSE2__ # include @@ -46,7 +47,7 @@ # define ZEND_ENDIAN_LOHI_C_4(a, b, c, d) a, b, c, d #endif -typedef unsigned char zend_bool; +typedef bool zend_bool; typedef unsigned char zend_uchar; typedef enum { From 5b7d30dd95ab5838c509f2381ebb6b136420ecae Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 9 Jun 2020 00:40:10 +0200 Subject: [PATCH 4/4] Drop useless cast --- main/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/main.c b/main/main.c index 4404fc52860b8..ae6b539ba2588 100644 --- a/main/main.c +++ b/main/main.c @@ -480,7 +480,7 @@ static zend_uchar php_get_display_errors_mode(char *value, size_t value_length) */ static PHP_INI_MH(OnUpdateDisplayErrors) { - PG(display_errors) = (zend_bool) php_get_display_errors_mode(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); + PG(display_errors) = php_get_display_errors_mode(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); return SUCCESS; }