1--TEST--
2Closures as a signal handler
3--SKIPIF--
4<?php
5	if (!extension_loaded("pcntl")) print "skip";
6	elseif (!function_exists("pcntl_signal")) print "skip pcntl_signal() not available";
7	elseif (!function_exists("posix_kill")) print "skip posix_kill() not available";
8	elseif (!function_exists("posix_getpid")) print "skip posix_getpid() not available";
9?>
10--FILE--
11<?php
12declare (ticks = 1);
13
14pcntl_signal(SIGTERM, function ($signo) { echo "Signal handler called!\n"; });
15
16echo "Start!\n";
17posix_kill(posix_getpid(), SIGTERM);
18$i = 0; // dummy
19echo "Done!\n";
20
21?>
22--EXPECT--
23Start!
24Signal handler called!
25Done!
26