From facc53668908b6aa06805566ea1f8a277c168345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 18 Nov 2017 13:42:56 +0100 Subject: [PATCH] Detect another way MySQL server needs SSL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #13436 Signed-off-by: Michal Čihař --- ChangeLog | 1 + libraries/dbi/DBIMysqli.php | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85db37fae0..06444922de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ phpMyAdmin - ChangeLog 4.7.6 (not yet released) - issue #13517 Fixed check all interaction with filtering - issue #13803 Add SJIS-win to default list of allowed charsets +- issue #13436 Improve detection that MySQL server needs SSL connection 4.7.5 (2017-10-23) - issue #13615 Avoid problems with browsing unknown query types diff --git a/libraries/dbi/DBIMysqli.php b/libraries/dbi/DBIMysqli.php index 16818694bc..0c9d5ca02b 100644 --- a/libraries/dbi/DBIMysqli.php +++ b/libraries/dbi/DBIMysqli.php @@ -144,15 +144,17 @@ class DBIMysqli implements DBIExtension if ($return_value === false || is_null($return_value)) { /* - * Switch to SSL if server asked us to do so + * Switch to SSL if server asked us to do so, unfortunately + * there are more ways MySQL server can tell this: * * - MySQL 8.0 and newer should return error 3159 - * - older use #2001 - SSL Connection is required. Please specify SSL options and retry. + * - #2001 - SSL Connection is required. Please specify SSL options and retry. + * - #9002 - SSL connection is required. Please specify SSL options and retry. */ $error_number = mysqli_connect_errno(); $error_message = mysqli_connect_error(); if (! $server['ssl'] && ($error_number == 3159 || - ($error_number == 2001 && stripos($error_message, 'SSL Connection is required') !== false)) + (($error_number == 2001 || $error_number == 9002) && stripos($error_message, 'SSL Connection is required') !== false)) ) { trigger_error( _('SSL connection enforced by server, automatically enabling it.'),