Why does $fd in Event::__construct under PHP-7 only support resource type?

Issue #31 closed
Timandes White created an issue

When I tried to send an integer $fd to Event::__construct as I tried it under PHP-5.4, I got a core dump at Z_TRY_ADDREF:

php7/classes/event.c@event_cb

    } else if (e->stream_res) {
        ZVAL_RES(&argv[0], e->stream_res);
        Z_TRY_ADDREF(argv[0]);

Should I convert $fd to resource type or is there a bug here? I'm so confused.

Comments (5)

  1. Ruslan Osmanov repo owner

    Actually, PHP5 version was also broken, because a numeric file descriptor was interpreted as a resource with id equal to the numeric fd. Both versions should be fixed by the above-mentioned commit.

  2. Log in to comment