[php-src] master: sapi: use bool type for headers_sent global

From: Date: Tue, 28 Jul 2026 07:54:14 +0000
Subject: [php-src] master: sapi: use bool type for headers_sent global
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-140245@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Date: 2026-07-28T08:53:13+01:00 Commit: https://github.com/php/php-src/commit/c30acf5b78b206e3d594e195949c02ff5b42f8c1 Raw diff: https://github.com/php/php-src/commit/c30acf5b78b206e3d594e195949c02ff5b42f8c1.diff sapi: use bool type for headers_sent global Changed paths: M main/SAPI.c M main/SAPI.h M sapi/cgi/cgi_main.c M sapi/cli/php_cli_server.c M sapi/fpm/fpm/fpm_main.c Diff: diff --git a/main/SAPI.c b/main/SAPI.c index 0ed241569db3..291b0de75cde 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -409,7 +409,7 @@ SAPI_API void sapi_activate(void) */ SG(sapi_headers).http_status_line = NULL; SG(sapi_headers).mimetype = NULL; - SG(headers_sent) = 0; + SG(headers_sent) = false; SG(read_post_bytes) = 0; SG(request_info).request_body = NULL; SG(request_info).current_user = NULL; @@ -517,7 +517,7 @@ SAPI_API void sapi_deactivate_destroy(void) } sapi_send_headers_free(); SG(sapi_started) = 0; - SG(headers_sent) = 0; + SG(headers_sent) = false; SG(request_info).headers_read = 0; SG(global_request_time) = 0; } @@ -871,7 +871,7 @@ SAPI_API int sapi_send_headers(void) zend_fcc_dtor(&fcc); } - SG(headers_sent) = 1; + SG(headers_sent) = true; if (sapi_module.send_headers) { retval = sapi_module.send_headers(&SG(sapi_headers)); @@ -908,7 +908,7 @@ SAPI_API int sapi_send_headers(void) ret = SUCCESS; break; case SAPI_HEADER_SEND_FAILED: - SG(headers_sent) = 0; + SG(headers_sent) = false; ret = FAILURE; break; } diff --git a/main/SAPI.h b/main/SAPI.h index 1e9a81866382..096774e08f4c 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -133,7 +133,7 @@ typedef struct _sapi_globals_struct { sapi_headers_struct sapi_headers; int64_t read_post_bytes; bool post_read; - unsigned char headers_sent; + bool headers_sent; zend_stat_t global_stat; char *default_mimetype; char *default_charset; diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 7efd8f159d59..841f45b207a8 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -2263,7 +2263,7 @@ consult the installation file that came with this distribution, or visit \n\ } fcgi_shutdown(); no_headers = 1; - SG(headers_sent) = 1; + SG(headers_sent) = true; php_cgi_usage(argv[0]); php_output_end_all(); exit_status = 0; @@ -2325,7 +2325,7 @@ consult the installation file that came with this distribution, or visit \n\ return FAILURE; } if (no_headers) { - SG(headers_sent) = 1; + SG(headers_sent) = true; SG(request_info).no_headers = 1; } php_print_info(0xFFFFFFFF); @@ -2343,7 +2343,7 @@ consult the installation file that came with this distribution, or visit \n\ if (script_file) { efree(script_file); } - SG(headers_sent) = 1; + SG(headers_sent) = true; php_printf("[PHP Modules]\n"); print_modules(); php_printf("\n[Zend Modules]\n"); @@ -2369,7 +2369,7 @@ consult the installation file that came with this distribution, or visit \n\ free(bindpath); return FAILURE; } - SG(headers_sent) = 1; + SG(headers_sent) = true; SG(request_info).no_headers = 1; php_print_version(&cgi_sapi_module); php_request_shutdown((void *) 0); @@ -2406,7 +2406,7 @@ consult the installation file that came with this distribution, or visit \n\ } if (no_headers) { - SG(headers_sent) = 1; + SG(headers_sent) = true; SG(request_info).no_headers = 1; } @@ -2466,7 +2466,7 @@ consult the installation file that came with this distribution, or visit \n\ return FAILURE; } if (no_headers) { - SG(headers_sent) = 1; + SG(headers_sent) = true; SG(request_info).no_headers = 1; } diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 797979b67305..e06f30b9e2d2 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -526,7 +526,7 @@ static void sapi_cli_server_flush(void *server_context) /* {{{ */ if (!SG(headers_sent)) { sapi_send_headers(); - SG(headers_sent) = 1; + SG(headers_sent) = true; } } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 827225387487..9b7cbcf16f06 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1636,7 +1636,7 @@ int main(int argc, char *argv[]) case 'm': /* list compiled in modules */ cgi_sapi_module.startup(&cgi_sapi_module); php_output_activate(); - SG(headers_sent) = 1; + SG(headers_sent) = true; php_printf("[PHP Modules]\n"); print_modules(); php_printf("\n[Zend Modules]\n"); @@ -1674,7 +1674,7 @@ int main(int argc, char *argv[]) case PHP_GETOPT_INVALID_ARG: cgi_sapi_module.startup(&cgi_sapi_module); php_output_activate(); - SG(headers_sent) = 1; + SG(headers_sent) = true; php_cgi_usage(argv[0]); php_output_end_all(); php_output_deactivate(); @@ -1689,7 +1689,7 @@ int main(int argc, char *argv[]) php_module_shutdown(); return FPM_EXIT_SOFTWARE; } - SG(headers_sent) = 1; + SG(headers_sent) = true; SG(request_info).no_headers = 1; php_print_version(&sapi_module); @@ -1710,7 +1710,7 @@ int main(int argc, char *argv[]) php_module_shutdown(); return FPM_EXIT_SOFTWARE; } - SG(headers_sent) = 1; + SG(headers_sent) = true; SG(request_info).no_headers = 1; php_print_info(0xFFFFFFFF); php_request_shutdown((void *) 0); @@ -1723,7 +1723,7 @@ int main(int argc, char *argv[]) if (argc != php_optind) { cgi_sapi_module.startup(&cgi_sapi_module); php_output_activate(); - SG(headers_sent) = 1; + SG(headers_sent) = true; php_cgi_usage(argv[0]); php_output_end_all(); php_output_deactivate();

« previous php.cvs (#140245) next »