Req #72409 [Opn->Csd]: pcntl_signal function could return previous value of the signal handler
| From: | trowski@php.net | Date: | Wed, 06 Jul 2016 19:09:21 +0000 |
| Subject: | Req #72409 [Opn->Csd]: pcntl_signal function could return previous value of the signal handler | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202104@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72409&edit=1
ID: 72409
Updated by: trowski@php.net
Reported by: jan dot kahoun at heureka dot cz
Summary: pcntl_signal function could return previous value of
the signal handler
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: PCNTL related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of dave@mudsite.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=217dcbcd911ad0552a4435fe979c069a5ddaef9f
Log: Fix #72409 - return previous handler
Previous Comments:
------------------------------------------------------------------------
[2016-06-18 08:16:35] dave at mudsite dot com
I created a patch that will return true when there isn't a user defined handler, but would
return the value set as the handler. It would be string, if string, or array if array.
------------------------------------------------------------------------
[2016-06-15 09:06:32] jan dot kahoun at heureka dot cz
Description:
------------
This function could be similar to C signal() function
(http://www.gnu.org/software/libc/manual/html_node/Basic-Signal-Handling.html) and return the
previous value of the signal handler for passed signal, or false on error. This can be helpfull when
you need to restore previous handler
Test script:
---------------
<?php
declare(ticks = 1);
function sig_handler($signo)
{
switch ($signo) {
case SIGTERM:
exit;
break;
default:
}
}
// this will return previous handler for SIGTERM signal
$previous_handler = pcntl_signal(SIGTERM, "sig_handler");
// restore previous handler
$previous_handler = pcntl_signal(SIGTERM, $previous_handler);
Expected result:
----------------
function pcntl_signal() returns previous value of the signal handler for passed signal on success or
FALSE on failure
Actual result:
--------------
function pcntl_signal() returns TRUE on success or FALSE on failure
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72409&edit=1