php-src/sapi/cli
Niels Dossche fb3536fd60
Fix leak+crash with sapi_windows_set_ctrl_handler()
The ctrl_handler is never destroyed. We have to destroy it at request
end so we avoid leaking it and also avoid keeping a reference to
previous request memory in a next request. The latter can result in a
crash and can be demonstrated with this script and `--repeat 2`:

```php
class Test {
	public function set() {
		sapi_windows_set_ctrl_handler(self::cb(...));
	}
	public function cb() {
	}
}

$test = new Test;
$test->set();
sleep(3);
```
When you hit CTRL+C in the second request you can crash.

This patch resolves both the leak and crash by destroying the
ctrl_handler after a request.

Closes GH-18231.
2025-05-05 19:13:39 +02:00
..
tests Fix leak+crash with sapi_windows_set_ctrl_handler() 2025-05-05 19:13:39 +02:00
cli.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
cli_win32.c
config.m4 Set libtool tag per command instead of global one 2024-01-10 09:09:45 +01:00
config.w32 Control VCRT leak reporting via environment variable in debug builds 2020-06-10 09:05:17 +02:00
CREDITS
generate_mime_type_map.php Update mime-db from 1.45.0 to 1.52.0 2022-07-08 07:39:38 +01:00
Makefile.frag Sync leading and final newlines in source code files 2018-10-14 12:56:38 +02:00
mime_type_map.h Update mime-db from 1.45.0 to 1.52.0 2022-07-08 07:39:38 +01:00
php.1.in Update year to 2024 2024-01-04 19:26:32 +01:00
php_cli.c Merge branch 'PHP-8.2' into PHP-8.3 2024-09-27 17:35:55 +02:00
php_cli_process_title.c Use size_t for get_ps_title() length parameter 2022-06-30 13:23:13 +01:00
php_cli_process_title.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_cli_process_title.stub.php Add stubs for SAPIs 2020-07-10 14:20:18 +02:00
php_cli_process_title_arginfo.h Add stubs for SAPIs 2020-07-10 14:20:18 +02:00
php_cli_server.c Merge branch 'PHP-8.2' into PHP-8.3 2024-11-20 11:12:19 +01:00
php_cli_server.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_cli_server.stub.php Add stubs for SAPIs 2020-07-10 14:20:18 +02:00
php_cli_server_arginfo.h Add stubs for SAPIs 2020-07-10 14:20:18 +02:00
php_http_parser.c Merge branch 'PHP-7.4' into PHP-8.0 2021-07-29 13:28:52 +02:00
php_http_parser.h Replace php_stdint.h header with standard headers (#8613) 2022-05-29 11:20:56 +01:00
ps_title.c Merge branch 'PHP-8.1' into PHP-8.2 2023-05-31 17:10:17 +02:00
ps_title.h Use size_t for get_ps_title() length parameter 2022-06-30 13:23:13 +01:00