xref: /PHP-8.4/ext/pcntl/tests/bug81577.phpt (revision fa0b84a0)
1--TEST--
2Bug #81577: (Exceptions in interrupt handlers)
3--EXTENSIONS--
4pcntl
5posix
6--FILE--
7<?php
8class C {
9	public static $cond = 1;
10	public static $a;
11}
12
13C::$a = [ C::$cond ]; // make countable zval
14
15pcntl_async_signals(true);
16pcntl_signal(SIGTERM, function ($signo) { throw new Exception("Signal"); });
17for ($i = 0; $i < 5; $i++) {
18	try {
19		C::$a + C::$a;
20		posix_kill(posix_getpid(), SIGTERM) + C::$cond;
21	} catch (Throwable $ex) {
22		echo get_class($ex) , " : " , $ex->getMessage() , "\n";
23	}
24}
25?>
26--EXPECT--
27Exception : Signal
28Exception : Signal
29Exception : Signal
30Exception : Signal
31Exception : Signal
32