Req #72409 [Com]: pcntl_signal function could return previous value of the signal handler

From: Date: Sat, 18 Jun 2016 08:16:37 +0000
Subject: Req #72409 [Com]: 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-201707@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 Comment by: dave at mudsite dot com Reported by: jan dot kahoun at heureka dot cz Summary: pcntl_signal function could return previous value of the signal handler Status: Open Type: Feature/Change Request Package: PCNTL related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#201707) next »