From: bh at ez dot no
Operating system: Debian Linux, Unstable
PHP version: 5.1.4
PHP Bug Type: PCNTL related
Bug description: Signal handling simply does not work!
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 bug report at http://bugs.php.net/?id=38480&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38480&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38480&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38480&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38480&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38480&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38480&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38480&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38480&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38480&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38480&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38480&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38480&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38480&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38480&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38480&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38480&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38480&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38480&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38480&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38480&r=mysqlcfg