Skip to content

Commit c30acf5

Browse files
committed
sapi: use bool type for headers_sent global
1 parent ec29a6b commit c30acf5

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

main/SAPI.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ SAPI_API void sapi_activate(void)
409409
*/
410410
SG(sapi_headers).http_status_line = NULL;
411411
SG(sapi_headers).mimetype = NULL;
412-
SG(headers_sent) = 0;
412+
SG(headers_sent) = false;
413413
SG(read_post_bytes) = 0;
414414
SG(request_info).request_body = NULL;
415415
SG(request_info).current_user = NULL;
@@ -517,7 +517,7 @@ SAPI_API void sapi_deactivate_destroy(void)
517517
}
518518
sapi_send_headers_free();
519519
SG(sapi_started) = 0;
520-
SG(headers_sent) = 0;
520+
SG(headers_sent) = false;
521521
SG(request_info).headers_read = 0;
522522
SG(global_request_time) = 0;
523523
}
@@ -871,7 +871,7 @@ SAPI_API int sapi_send_headers(void)
871871
zend_fcc_dtor(&fcc);
872872
}
873873

874-
SG(headers_sent) = 1;
874+
SG(headers_sent) = true;
875875

876876
if (sapi_module.send_headers) {
877877
retval = sapi_module.send_headers(&SG(sapi_headers));
@@ -908,7 +908,7 @@ SAPI_API int sapi_send_headers(void)
908908
ret = SUCCESS;
909909
break;
910910
case SAPI_HEADER_SEND_FAILED:
911-
SG(headers_sent) = 0;
911+
SG(headers_sent) = false;
912912
ret = FAILURE;
913913
break;
914914
}

main/SAPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ typedef struct _sapi_globals_struct {
133133
sapi_headers_struct sapi_headers;
134134
int64_t read_post_bytes;
135135
bool post_read;
136-
unsigned char headers_sent;
136+
bool headers_sent;
137137
zend_stat_t global_stat;
138138
char *default_mimetype;
139139
char *default_charset;

sapi/cgi/cgi_main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ consult the installation file that came with this distribution, or visit \n\
22632263
}
22642264
fcgi_shutdown();
22652265
no_headers = 1;
2266-
SG(headers_sent) = 1;
2266+
SG(headers_sent) = true;
22672267
php_cgi_usage(argv[0]);
22682268
php_output_end_all();
22692269
exit_status = 0;
@@ -2325,7 +2325,7 @@ consult the installation file that came with this distribution, or visit \n\
23252325
return FAILURE;
23262326
}
23272327
if (no_headers) {
2328-
SG(headers_sent) = 1;
2328+
SG(headers_sent) = true;
23292329
SG(request_info).no_headers = 1;
23302330
}
23312331
php_print_info(0xFFFFFFFF);
@@ -2343,7 +2343,7 @@ consult the installation file that came with this distribution, or visit \n\
23432343
if (script_file) {
23442344
efree(script_file);
23452345
}
2346-
SG(headers_sent) = 1;
2346+
SG(headers_sent) = true;
23472347
php_printf("[PHP Modules]\n");
23482348
print_modules();
23492349
php_printf("\n[Zend Modules]\n");
@@ -2369,7 +2369,7 @@ consult the installation file that came with this distribution, or visit \n\
23692369
free(bindpath);
23702370
return FAILURE;
23712371
}
2372-
SG(headers_sent) = 1;
2372+
SG(headers_sent) = true;
23732373
SG(request_info).no_headers = 1;
23742374
php_print_version(&cgi_sapi_module);
23752375
php_request_shutdown((void *) 0);
@@ -2406,7 +2406,7 @@ consult the installation file that came with this distribution, or visit \n\
24062406
}
24072407

24082408
if (no_headers) {
2409-
SG(headers_sent) = 1;
2409+
SG(headers_sent) = true;
24102410
SG(request_info).no_headers = 1;
24112411
}
24122412

@@ -2466,7 +2466,7 @@ consult the installation file that came with this distribution, or visit \n\
24662466
return FAILURE;
24672467
}
24682468
if (no_headers) {
2469-
SG(headers_sent) = 1;
2469+
SG(headers_sent) = true;
24702470
SG(request_info).no_headers = 1;
24712471
}
24722472

sapi/cli/php_cli_server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static void sapi_cli_server_flush(void *server_context) /* {{{ */
526526

527527
if (!SG(headers_sent)) {
528528
sapi_send_headers();
529-
SG(headers_sent) = 1;
529+
SG(headers_sent) = true;
530530
}
531531
} /* }}} */
532532

sapi/fpm/fpm/fpm_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ int main(int argc, char *argv[])
16361636
case 'm': /* list compiled in modules */
16371637
cgi_sapi_module.startup(&cgi_sapi_module);
16381638
php_output_activate();
1639-
SG(headers_sent) = 1;
1639+
SG(headers_sent) = true;
16401640
php_printf("[PHP Modules]\n");
16411641
print_modules();
16421642
php_printf("\n[Zend Modules]\n");
@@ -1674,7 +1674,7 @@ int main(int argc, char *argv[])
16741674
case PHP_GETOPT_INVALID_ARG:
16751675
cgi_sapi_module.startup(&cgi_sapi_module);
16761676
php_output_activate();
1677-
SG(headers_sent) = 1;
1677+
SG(headers_sent) = true;
16781678
php_cgi_usage(argv[0]);
16791679
php_output_end_all();
16801680
php_output_deactivate();
@@ -1689,7 +1689,7 @@ int main(int argc, char *argv[])
16891689
php_module_shutdown();
16901690
return FPM_EXIT_SOFTWARE;
16911691
}
1692-
SG(headers_sent) = 1;
1692+
SG(headers_sent) = true;
16931693
SG(request_info).no_headers = 1;
16941694

16951695
php_print_version(&sapi_module);
@@ -1710,7 +1710,7 @@ int main(int argc, char *argv[])
17101710
php_module_shutdown();
17111711
return FPM_EXIT_SOFTWARE;
17121712
}
1713-
SG(headers_sent) = 1;
1713+
SG(headers_sent) = true;
17141714
SG(request_info).no_headers = 1;
17151715
php_print_info(0xFFFFFFFF);
17161716
php_request_shutdown((void *) 0);
@@ -1723,7 +1723,7 @@ int main(int argc, char *argv[])
17231723
if (argc != php_optind) {
17241724
cgi_sapi_module.startup(&cgi_sapi_module);
17251725
php_output_activate();
1726-
SG(headers_sent) = 1;
1726+
SG(headers_sent) = true;
17271727
php_cgi_usage(argv[0]);
17281728
php_output_end_all();
17291729
php_output_deactivate();

0 commit comments

Comments
 (0)