EvIo object inconsistent in PHP7

Issue #18 resolved
Benjamin G created an issue

Hello,

When I use EvIo in PHP7, fd, disappear after the first use.

Here is an example:

<?php
$f = tmpfile();
$io = new \EvIo($f, 1, function(\EvIo $ev) {
    var_dump($ev);
    var_dump($ev);
    \Ev::stop();
});
$tick = new \EvTimer(0, 1, function () use ($f) {
    echo "Tick !\n";
    fwrite($f, "Test\n"); 
});
\Ev::run();

Output

# php -dextension=ev.so ./test.php
Tick !
object(EvIo)#1 (6) {
  ["fd"]=>
  resource(5) of type (stream)
  ["events"]=>
  int(1)
  ["is_active"]=>
  bool(true)
  ["data"]=>
  NULL
  ["is_pending"]=>
  bool(false)
  ["priority"]=>
  int(0)
}
object(EvIo)#1 (6) {
  ["fd"]=>
  NULL
  ["events"]=>
  int(1)
  ["is_active"]=>
  bool(true)
  ["data"]=>
  NULL
  ["is_pending"]=>
  bool(false)
  ["priority"]=>
  int(0)
}

As you can see, fd is null at second var_dump.

Thanks!

Comments (4)

  1. Log in to comment