php8.5
Home/ Manual/ event / eventbufferevent/ EventBufferEvent::sslError

EventBufferEvent::sslError

PHP function Edit on GitHub ✎

(PECL event >= 1.2.6-beta)

Returns most recent OpenSSL error reported on the buffer event

Description

EventBufferEvent::sslError(): string

Returns most recent OpenSSL error reported on the buffer event.

Note

This function is available only if Event is compiled with OpenSSL support.

Parameters Parameters

Return Values

Returns OpenSSL error string reported on the buffer event, or false, if there is no more error to return.

Examples

EventBufferEvent::sslError() example

php
<?php
// This callback is invoked when some event occurs on the event listener,
// e.g. connection closed, or an error occurred
function ssl_event_cb($bev, $events, $ctx) {
    if ($events & EventBufferEvent::ERROR) {
        // Fetch errors from the SSL error stack
        while ($err = $bev->sslError()) {
            fprintf(STDERR, "Bufferevent error %s.\n", $err);
        }
    }

    if ($events & (EventBufferEvent::EOF | EventBufferEvent::ERROR)) {
        $bev->free();
    }
}
?>

See Also

  • EventBufferEvent::sslRenegotiate

Source: reference/event/eventbufferevent/sslerror.xml · from the official PHP manual (php/doc-en)