expressif / pecl-event-libevent

PHP7 Libevent - event notification
http://pecl.php.net/package/libevent
56 stars 16 forks source link

Make test fail with certificate verify failed #27

Open Joungkyun opened 4 years ago

Joungkyun commented 4 years ago
[user@host libevent]$ make test PHP_EXECUTABLE=/usr/bin/php
[user@host libevent]$ cat tests/libevent001.out

Warning: fopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate
verify failed in /tmp/libevent/tests/libevent001.php on line 19

Warning: fopen(): Failed to enable crypto in
/tmp/libevent/tests/libevent001.php on line 19

Warning:
fopen(https://raw.githubusercontent.com/expressif/pecl-event-libevent/master/tests/input.txt):
failed to open stream: operation failed in
/tmp/libevent/tests/libevent001.php on line 19

Warning: event_set(): fd argument must be valid PHP stream or socket
resource or a file descriptor of type long in
/tmp/libevent/tests/libevent001.php on line 33
bool(false)

Warning: event_set(): fd argument must be valid PHP stream or socket
resource or a file descriptor of type long in
/tmp/libevent/tests/libevent001.php on line 34
bool(false)
bool(false)

Warning: event_add(): Unable to add event without an event base in
/tmp/libevent/tests/libevent001.php on line 36
bool(false)
int(1)
[warn] event_del: event has no event_base set.

origianl code:

$fd = fopen('https://raw.githubusercontent.com/expressif/pecl-event-libevent/master/tests/input.txt', 'r');

enhanced code: ( >= php 5.0.0 )

$fd = fopen(
    'https://raw.githubusercontent.com/expressif/pecl-event-libevent/master/tests/input.txt',
    'r', false,
    stream_context_create (
        array (
            'ssl' => array (
                'verify_peer' => false,
                'verify_peer_name' => false
            )
        )
    )
);