Welcome Guest, Not a member yet? Register   Sign In
Email Class SSL verification bug on PHP 5.6 (SSL3_GET_SERVER_CERTIFICATE)

As you guys may know, PHP 5.6 version has gone into some important changes that Codeigniter 2 haven't been adapted to. Though I had only one single PHP command line to change (I may not recall what it was) in a CI system file, now I am stuck with a bug I found on Email Class to send messages via SMTP (using Google server).

Apparently, PHP 5.6 has some OpenSSL changes:
Quote:"All encrypted client streams now enable peer verification by default. By default, this will use OpenSSL's default CA bundle to verify the peer certificate. In most cases, no changes will need to be made to communicate with servers with valid SSL certificates, as distributors generally configure OpenSSL to use known good CA bundles." - OpenSSL changes in PHP 5.6.x (PHP Manual)

The documentation recommend to set verify_peer and verify_peer_name to FALSE for SSL verification. However, I don't know how to implement that when it comes to fsockopen. The Email Class has the following function:

protected function _smtp_connect()
    $ssl = NULL;
    if ($this->smtp_crypto == 'ssl')
        $ssl = 'ssl://';
    $this->_smtp_connect = fsockopen($ssl.$this->smtp_host,
    if ( ! is_resource($this->_smtp_connect))
        $this->_set_error_message('lang:email_smtp_error', $errno." ".$errstr);
        return FALSE;
    if ($this->smtp_crypto == 'tls')
        stream_socket_enable_crypto($this->_smtp_connect, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT);
    return $this->_send_command('hello');

Do you guys have any idea of how I should implement this function for PHP 5.6? I'll keep trying it out. Basically, the SSL message error I get is:
Quote:fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Messages In This Thread
Email Class SSL verification bug on PHP 5.6 (SSL3_GET_SERVER_CERTIFICATE) - by Rômulo Rocha - 12-23-2014, 07:01 AM

Theme © iAndrew 2016 - Forum software by © MyBB