From 89576a8cf0918c4d1797f6ef34be98b5caef29d3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jan 2016 14:39:04 +0200 Subject: Add support for MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT Available since PHP 5.6.16 --- system/database/drivers/mysqli/mysqli_driver.php | 17 +++++++++++++++-- user_guide_src/source/changelog.rst | 8 ++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 693a96bab..34366827b 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -153,9 +153,22 @@ class CI_DB_mysqli_driver extends CI_DB { if ( ! empty($ssl)) { - if ( ! empty($this->encrypt['ssl_verify']) && defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT')) + if (isset($this->encrypt['ssl_verify'])) { - $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE); + if ($this->encrypt['ssl_verify']) + { + defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') && $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE); + } + // Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT + // to FALSE didn't do anything, so PHP 5.6.16 introduced yet another + // constant ... + // + // https://secure.php.net/ChangeLog-5.php#5.6.16 + // https://bugs.php.net/bug.php?id=68344 + elseif (defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT')) + { + $this->_mysqli->options(MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT, TRUE); + } } $client_flags |= MYSQLI_CLIENT_SSL; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 89368f3ab..52c424614 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -11,7 +11,11 @@ Release Date: Not Released - Updated :doc:`Security Library ` method ``get_random_bytes()`` to use PHP 7's ``random_bytes()`` function when possible. - Updated :doc:`Encryption Library ` method ``create_key()`` to use PHP 7's ``random_bytes()`` function when possible. - - Updated :doc:`Database ` drivers 'oci8' and 'pdo/oci' with support for ``OFFSET-FETCH`` with Oracle 12c. + +- :doc:`Database ` + + - Added support for ``OFFSET-FETCH`` with Oracle 12c for the 'oci8' and 'pdo/oci' drivers. + - Added support for the new ``MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT`` constant from `PHP 5.6.16 `_ for the 'mysqli' driver. Bug fixes for 3.0.4 ------------------- @@ -46,7 +50,7 @@ Release Date: October 31, 2015 - Changed :doc:`Config Library ` method ``base_url()`` to fallback to ``$_SERVER['SERVER_ADDR']`` when ``$config['base_url']`` is empty in order to avoid *Host* header injections. - Changed :doc:`CAPTCHA Helper ` to use the operating system's PRNG when possible. -- Database +- :doc:`Database` - Optimized :doc:`Database Utility ` method ``csv_from_result()`` for speed with larger result sets. - Added proper return values to :doc:`Database Transactions ` method ``trans_start()``. -- cgit v1.2.3-24-g4f1b