From 973fcaacf2e23ff1d88ce664495c72ea2bf8177e Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 28 Feb 2023 12:06:21 +1000 Subject: [PATCH] Add a connect timeout explicitly to wpdb. While this generally has the same effect as the default_socket_timeout ini setting, but hopefully in future PHPs it would apply to the whole handshake. --- db.php | 1 + 1 file changed, 1 insertion(+) diff --git a/db.php b/db.php index f1a7e01..db23a05 100644 --- a/db.php +++ b/db.php @@ -1489,6 +1489,7 @@ public function ex_mysql_connect( $db_host, $db_user, $db_password, $persistent $db_host = "p:{$db_host}"; } + mysqli_options( $dbh, MYSQLI_OPT_CONNECT_TIMEOUT, $this->ex_mysql_connect_timeout() ); $retval = mysqli_real_connect( $dbh, $db_host, $db_user, $db_password, null, $port, $socket, $client_flags ); if ( ! $retval || $dbh->connect_errno ) {