php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64652 Event() segfaults on unexisting files and php://temp
Submitted: 2013-04-16 16:34 UTC Modified: 2014-04-08 09:39 UTC
From: andrey dot kalinovsky at gmail dot com Assigned: osmanov (profile)
Status: Closed Package: event (PECL)
PHP Version: 5.4.14 OS: Mac OSX/Ubuntu 12.10
Private report: No CVE-ID: None
 [2013-04-16 16:34 UTC] andrey dot kalinovsky at gmail dot com
Description:
------------
Event seems to segfault when given an unexisting fd or php://temp

Test script:
---------------
<?php

$base = new EventBase();
$input = fopen("php://temp", "r+");

$event = new Event($base, $input, Event::READ, function ($fd, $events, $arg) {
    echo "OK";
  });

$event->add();
$base->loop();

?>

Expected result:
----------------
OK

Actual result:
--------------
HP Warning:  Event::__construct(): fcntl: invalid file descriptor passed in 
/Users/andrey/react/eventTest.php on line 8
PHP Stack trace:
PHP   1. {main}() /Users/andrey/react/eventTest.php:0
PHP   2. Event->__construct() /Users/andrey/react/eventTest.php:8

Warning: Event::__construct(): fcntl: invalid file descriptor passed in 
/Users/andrey/react/eventTest.php on line 8

Call Stack:
    0.0002     241160   1. {main}() /Users/andrey/react/eventTest.php:0
    0.0005     246032   2. Event->__construct() 
/Users/andrey/react/eventTest.php:8

Segmentation fault: 11

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-16 16:36 UTC] andrey dot kalinovsky at gmail dot com
Copy/paste fail, it was meant to be PHP Warning, not HP Warning, obviously.
 [2013-04-17 16:19 UTC] osmanov@php.net
-Assigned To: +Assigned To: osmanov
 [2013-04-17 19:07 UTC] osmanov@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

Fixed in event-1.6.1
 [2013-04-17 19:07 UTC] osmanov@php.net
-Status: Assigned +Status: Closed
 [2013-04-17 19:08 UTC] osmanov@php.net
However, php://temp stream is not yet supported. I'll try to provide support for it later.
 [2014-04-08 07:56 UTC] heruan at aldu dot net
Are php://temp streams still not supported?
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Sep 20 14:01:28 2019 UTC