From a1310144a681b086699f848830f0dbb848101c61 Mon Sep 17 00:00:00 2001
From: Paul Biron <paul@sparrowhawkcomputing.com>
Date: Sat, 30 Jan 2021 09:53:25 -0700
Subject: [PATCH] Update patch so it applies cleanly now.

---
 src/wp-includes/wp-db.php | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php
index 2ec3312c46..8b70e90efd 100644
--- a/src/wp-includes/wp-db.php
+++ b/src/wp-includes/wp-db.php
@@ -1649,6 +1649,27 @@ class wpdb {
 				$host = "[$host]";
 			}
 
+			// call set_ssl if mysql client flag set.
+			if ( $client_flags & MYSQL_CLIENT_SSL ) {
+				$pack     = array( $this->dbh );
+				$call_set = false;
+				foreach( array( 'MYSQL_SSL_KEY', 'MYSQL_SSL_CERT', 'MYSQL_SSL_CA', 'MYSQL_SSL_CAPATH', 'MYSQL_SSL_CIPHER' ) as $opt_key ) {
+					$pack[]   = ( defined( $opt_key ) ) ? constant( $opt_key ) : null;
+					$call_set |= defined( $opt_key );
+				}
+
+				/*
+				 *  Now if anything was packed - unpack into the function.
+				 * Note this doesn't check if paths exist, as per the PHP doc
+				 * at http://www.php.net/manual/en/mysqli.ssl-set.php: "This
+				 * function always returns TRUE value. If SSL setup is incorrect
+				 * mysqli_real_connect() will return an error ...".
+				 */
+				if ( $call_set ) { // SSL added here!
+					call_user_func_array( 'mysqli_ssl_set', $pack );
+				}
+			}
+
 			if ( WP_DEBUG ) {
 				mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
 			} else {
-- 
2.28.0.windows.1

