ID: 38480
Updated by: [EMAIL PROTECTED]
Reported By: bh at ez dot no
-Status: Open
+Status: Bogus
Bug Type: PCNTL related
Operating System: Debian Linux, Unstable
PHP Version: 5.1.4
New Comment:
Ticks are required since 4.3.0:
declare(ticks = 1);
Previous Comments:
------------------------------------------------------------------------
[2006-08-17 09:42:20] bh at ez dot no
Description:
------------
PHP5-CLI: "pcntl_signal" is malfunctioning. It traps the desidred
signal(s) but it does not execute the code which is in the custom
signal handler! This is very annoying.
Reproduce code:
---------------
<?php
function whatever( $signal )
{
echo( "Inside whatever, got $signal\n" );
}
pcntl_signal( SIGTERM, 'whatever' );
pcntl_signal( SIGUSR1, 'whatever' );
echo( 'My PID is: ' . getmypid() . "\n" );
// Hard-sleep for 30 secs.
time_sleep_until( microtime( true ) + 30 );
echo( "Bye.\n" );
?>
Expected result:
----------------
Start up the provided source code using PHP5-CLI, remember the PID that
the script outputs and use "kill -15 <PID>" to send a SIGTERM to it.
The script should trap the signal, execute the custom signal handler
code and thus output:
"Inside whatever, got 15"
However, this does not happen. Note that the signal is in fact CAUGHT,
because if you remove the handler for SIGTERM and then send a signal 15
to the script, it will self-terminate.
Apparently none of the other signals work either (checked with
SIGUSR1/2, etc.).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38480&edit=1