mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-21 02:18:28 +02:00
fix PHP 8.x throws mysqli_sql_exception when it can not connect
This commit is contained in:
parent
f1cba99aa9
commit
b13c1d97b4
@ -544,6 +544,8 @@ class Db
|
|||||||
($Type !== 'mysqli' || ini_get('mysqli.allow_persistent')) ?
|
($Type !== 'mysqli' || ini_get('mysqli.allow_persistent')) ?
|
||||||
'PConnect' : 'Connect';
|
'PConnect' : 'Connect';
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (($Ok = $this->Link_ID->$connect($Host, $User, $Password, $Database)))
|
if (($Ok = $this->Link_ID->$connect($Host, $User, $Password, $Database)))
|
||||||
{
|
{
|
||||||
$this->ServerInfo = $this->Link_ID->ServerInfo();
|
$this->ServerInfo = $this->Link_ID->ServerInfo();
|
||||||
@ -555,6 +557,11 @@ class Db
|
|||||||
$this->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))", __LINE__, __FILE__);
|
$this->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (\mysqli_sql_exception $e) {
|
||||||
|
_egw_log_exception($e);
|
||||||
|
$Ok = false;
|
||||||
|
}
|
||||||
if (!$Ok)
|
if (!$Ok)
|
||||||
{
|
{
|
||||||
$Host = preg_replace('/password=[^ ]+/','password=$Password',$Host); // eg. postgres dsn contains password
|
$Host = preg_replace('/password=[^ ]+/','password=$Password',$Host); // eg. postgres dsn contains password
|
||||||
|
Loading…
x
Reference in New Issue
Block a user