From 7fb55d67a84c68031c4e29a880b7833491a233cd Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 15 Aug 2024 23:06:59 -0700 Subject: [PATCH] database: report connection failure in _mysql_connect() This is used in the upgrade script and some old web pages. You need to check $mysql->connect_errno after doing new mysqli --- html/inc/db.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/inc/db.inc b/html/inc/db.inc index aec1d50c35..5ff5522999 100644 --- a/html/inc/db.inc +++ b/html/inc/db.inc @@ -48,6 +48,9 @@ if (MYSQLI) { $port = null; } $mysqli = @new mysqli($host, $user, $pass, $dbname, $port); + if ($mysqli->connect_errno) { + return null; + } return $mysqli; } function _mysql_query($q) {