summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-07-16 13:23:51 +0200
committerAndrey Andreev <narf@devilix.net>2015-07-16 13:23:51 +0200
commit9194b492f900b05acd204cb1b4a524149402be75 (patch)
tree20220a3524d2180c494b9e3f01005065758d4b35 /system/database/drivers
parent0785e47152dcb3d3a96c04bc9507eff36a1926c1 (diff)
Improve the ssl_cipher check for MySQLi
Related: #3896
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 82abf4e73..8d398c866 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -156,16 +156,16 @@ class CI_DB_mysqli_driver extends CI_DB {
if ($mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags))
{
// Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails
- if (($client_flags & MYSQLI_CLIENT_SSL) && version_compare($mysqli->client_info, '5.7.3', '<='))
+ if (
+ ($client_flags & MYSQLI_CLIENT_SSL)
+ && version_compare($mysqli->client_info, '5.7.3', '<=')
+ && empty($mysqli->query("SHOW STATUS LIKE 'ssl_cipher'")->fetch_object()->Value)
+ )
{
- $ssl = $mysqli->query("SHOW STATUS LIKE 'ssl_cipher'")->fetch_row();
- if (empty($ssl[1]))
- {
- $mysqli->close();
- $message = 'MySQLi was configured for an SSL connection, but got an unencrypted connection instead!';
- log_message('error', $message);
- return ($this->db->db_debug) ? $this->db->display_error($message, '', TRUE) : FALSE;
- }
+ $mysqli->close();
+ $message = 'MySQLi was configured for an SSL connection, but got an unencrypted connection instead!';
+ log_message('error', $message);
+ return ($this->db->db_debug) ? $this->db->display_error($message, '', TRUE) : FALSE;
}
return $mysqli;