1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/sapi/cli/tests
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
..
2020-04-08 17:11:50 +02:00
2020-09-18 14:28:32 +02:00
2020-08-10 12:54:02 +02:00
2020-09-18 14:28:32 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-09-18 14:28:32 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2021-06-30 16:48:31 +02:00
2020-08-10 10:38:33 +02:00
2020-08-10 10:38:33 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-04-08 17:11:50 +02:00
2020-02-03 22:52:20 +01:00
2023-03-27 16:33:36 +02:00