php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61673 PHP callback function args wrong for signal handler
Submitted: 2012-04-08 12:47 UTC Modified: 2012-04-08 18:58 UTC
From: harvey dot robin at gmail dot com Assigned: tony2001 (profile)
Status: Closed Package: libevent (PECL)
PHP Version: Irrelevant OS: Linux, Ubuntu 11.10
Private report: No CVE-ID: None
 [2012-04-08 12:47 UTC] harvey dot robin at gmail dot com
Description:
------------
When a function is set to receive EV_SIGNAL events, the raised signal should be the first parameter to the PHP callback function.  For me, the value is always zero.

[ Source: "Signal number or resource indicating the stream. "  - http://www.php.net/manual/en/function.event-set.php ]

Test script:
---------------
<?php
/**
 * Run this script, then press  ctrl-c in your terminal to trigger the
 * bug
 */
$base = event_base_new();
$ev = event_new();
event_set($ev, SIGINT, EV_SIGNAL, 'handler');
event_base_set($ev, $base);
event_add($ev);
event_base_loop($base);
echo "Complete\n";



function handler ($fd, $events, $params) {
    printf("I've just recived notification of signal %d by events mask %d\n", $fd, $events);
}

Expected result:
----------------
^CI've just recived notification of signal 2 by events mask 8
Complete

Actual result:
--------------
^CI've just recived notification of signal 0 by events mask 8
Complete

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-08 12:50 UTC] harvey dot robin at gmail dot com
BTW: This has been tested on the 0.0.5 + bug 61653 fix extension version.
 [2012-04-08 15:38 UTC] tony2001@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: tony2001
 [2012-04-08 18:58 UTC] tony2001@php.net
Automatic comment from SVN on behalf of tony2001
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=324973
Log: fix #61673 (callback function args are wrong for signal handler)
 [2012-04-08 18:58 UTC] tony2001@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-08 18:58 UTC] tony2001@php.net
-Status: Assigned +Status: Closed
 [2013-05-22 11:09 UTC] tony2001@php.net
Automatic comment on behalf of tony@daylessday.org
Revision: http://git.php.net/?p=pecl/event/libevent.git;a=commit;h=26bfc49356622be7c1473edd6c3b82421714f030
Log: fix #61673 (callback function args are wrong for signal handler)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC