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