Invalid file descriptor exceptions on PHP 7.2

Issue #49 resolved
kelunik
created an issue

With the latest version, PHP 7.2 throws "Invalid file descriptor" exceptions, while the same code works fine with the extension on PHP 7.1 and 7.0.

See also https://github.com/amphp/amp/issues/221.

Comments (6)

  1. kelunik reporter

    I just verified again that everything works fine with PHP 7.1 with both ext-event 2.3.0 and 2.4.0RC1, but fails on PHP 7.2.1 with ext-event 2.4.0RC1, while it works fine with PHP 7.2.1 and ext-event 2.3.0.

  2. kelunik reporter
    <?php
    
    require __DIR__ . '/vendor/autoload.php';
    
    $loop = new class {
        private $handle;
        private $ioCallback;
        private $events;
    
        public function __construct() {
            $this->handle = new EventBase;
    
            $this->ioCallback = function () {
                var_dump(__FILE__ . ':' . __LINE__);
            };
        }
    
        public function watch($stream) {
            $this->events[(int) $stream] = $event = new Event(
                $this->handle,
                $stream,
                Event::READ | Event::PERSIST,
                $this->ioCallback,
                null
            );
    
            $event->add();
        }
    
        public function run() {
            $this->handle->loop(true);
        }
    };
    
    $loop->watch(STDOUT);
    $loop->run();
    
  3. Log in to comment