Fix #78919: CLI server: insufficient cleanup if request startup fails

We need to run the full `php_cli_server_request_shutdown()` in case of
failing `php_cli_server_request_startup()`.

Patch contributed by @cataphract.

Closes GH-7322.
This commit is contained in:
Christoph M. Becker 2021-07-30 15:36:12 +02:00
parent ef5558a8cd
commit be2df43b08
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
2 changed files with 3 additions and 5 deletions

View file

@ -2126,8 +2126,6 @@ static int php_cli_server_request_startup(php_cli_server *server, php_cli_server
}
SG(sapi_headers).http_response_code = 200;
if (FAILURE == php_request_startup()) {
/* should never be happen */
destroy_request_info(&SG(request_info));
return FAILURE;
}
PG(during_request_startup) = 0;
@ -2198,9 +2196,7 @@ static int php_cli_server_dispatch(php_cli_server *server, php_cli_server_client
if (server->router || !is_static_file) {
if (FAILURE == php_cli_server_request_startup(server, client)) {
SG(server_context) = NULL;
php_cli_server_close_connection(server, client);
destroy_request_info(&SG(request_info));
php_cli_server_request_shutdown(server, client);
return SUCCESS;
}
}