|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-05-20 15:12 UTC] harvey dot robin at gmail dot com
[2012-05-20 15:12 UTC] harvey dot robin at gmail dot com
-Summary: EV_PERSIST flag not passed to
+Summary: EV_PERSIST flag not passed to php callback
[2012-05-21 07:23 UTC] tony2001@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: tony2001
[2012-05-21 08:36 UTC] tony2001@php.net
-Status: Assigned
+Status: Not a bug
[2012-05-21 08:36 UTC] tony2001@php.net
[2012-05-21 11:34 UTC] harvey dot robin at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 03:00:01 2025 UTC |
Description: ------------ Raised events don't contain the EV_PERSIST flag in cases where you pass this to event_set(). My computer setup: Fedora 17 - x86_64 PHP 5.4.1 (fedora) php-libevent - built from source, SVN rev is #325757 libevent packages: [robin@robin-desktop libevent]$ rpm -qa '*libevent*' libevent-2.0.18-1.fc17.x86_64 libevent-devel-2.0.18-1.fc17.x86_64 Test script: --------------- <?php $base = event_base_new(); $event = event_new(); $fd = getTestSocket (); event_set($event, $fd, EV_WRITE | EV_PERSIST, "testCallback", array($event, $base)); event_base_set($event, $base); event_add($event); event_base_loop($base); function testCallback ($fd, $events, $arg) { printf("Callback invoked with flags: %s\n", implode("\n", getFlags($events))); event_base_loopexit($arg[1]); } function getFlags ($val) { $r = array(); if ($val & EV_READ) { $r[] = 'EV_READ'; } if ($val & EV_WRITE) { $r[] = 'EV_WRITE'; } if ($val & EV_TIMEOUT) { $r[] = 'EV_TIMEOUT'; } if ($val & EV_SIGNAL) { $r[] = 'EV_SIGNAL'; } if ($val & EV_PERSIST) { $r[] = 'EV_PERSIST'; } return $r; } function getTestSocket () { $host = '72.249.45.9'; $port = 80; if (! ($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) { throw new Exception("Failed to create inet socket", 7895); } else if (! socket_connect($sock, $host, $port)) { throw new Exception("Failed to connect inet socket ({$host}, {$port})", 7564); } else if (! socket_set_nonblock($sock)) { throw new Exception("Failed to switch connection in to non-blocking mode.", 2357); } return $sock; } Expected result: ---------------- Callback invoked with flags: EV_WRITE, EV_PERSIST Actual result: -------------- Callback invoked with flags: EV_WRITE