Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test fail with certificate verify failed #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Make test fail with certificate verify failed #27

wants to merge 1 commit into from

Conversation

Joungkyun
Copy link

  • Prevent "certificate verify failed" error when opening https url with fopen
  • fixed typo README.md
[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
            )
        )
    )
);

```bash
[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.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant