Commit c30acf5b78b for php.net

commit c30acf5b78b206e3d594e195949c02ff5b42f8c1
Author: Gina Peter Banyard <girgias@php.net>
Date:   Mon Jul 27 19:45:05 2026 +0100

    sapi: use bool type for headers_sent global

diff --git a/main/SAPI.c b/main/SAPI.c
index 0ed241569db..291b0de75cd 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 1e9a8186638..096774e08f4 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 7efd8f159d5..841f45b207a 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 797979b6730..e06f30b9e2d 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 82722538748..9b7cbcf16f0 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();