sapi_send_headers bug
Description
version:php 7.4.27 file: SAPI.c function: sapi_send_headers code:
if (sapi_module.send_headers) {
retval = sapi_module.send_headers(&SG(sapi_headers));
} else {
retval = SAPI_HEADER_DO_SEND;
}
switch (retval) {
case SAPI_HEADER_DO_SEND: {
......
sapi_module.send_header(&http_status_line, SG(server_context));
}
describe: I didn't set sapi_module.send_headers in sapi_module_struct, so this function is NULL. retval = SAPI_HEADER_DO_SEND; But call sapi_module.send_header in this switch,it could cause crash.
PHP Version
php 7.4.27
Operating System
No response
The switch uses send_header, not send_headers. No 's'.
The switch uses
send_header, notsend_headers. No 's'.
I set sapi_module.send_headers = NULL, sapi_module.send_header=NULL
Maybe need:
if (sapi_module.send_header){
sapi_module.send_header(&http_status_line, SG(server_context));
}
Well, to my knowledge there is no comprehensive documentation about the sapi_module_struct, but from looking at the implementation of the embed SAPI, send_header is supposed to be not NULL; instead, a function which does nothing is used:
https://github.com/php/php-src/blob/0e88f749ff00d70f0d0cd2caa1ebb17e0103cd8c/sapi/embed/php_embed.c#L100-L102
So this doesn't look like a bug to me.