summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-01-07 13:39:04 +0100
committerAndrey Andreev <narf@devilix.net>2016-01-07 13:39:04 +0100
commit89576a8cf0918c4d1797f6ef34be98b5caef29d3 (patch)
tree5200cd6378d545a0548a492b533555dd48e03152 /system
parent20d7d65fd3fca54b86f389b149da5a0d2f2d6808 (diff)
Add support for MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT
Available since PHP 5.6.16
Diffstat (limited to 'system')
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php17
1 files changed, 15 insertions, 2 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;