diff options
| author | Mark Newnham <mark@newnhams.com> | 2022-06-21 10:04:32 -0600 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2022-07-23 21:11:25 +0200 |
| commit | c49e0065caad04307a025aa571d1246a92cbb891 (patch) | |
| tree | 23afba4bd10c7a843640d74b90fc22b63c0f7668 /drivers | |
| parent | 4d5e9f49687c2c5e08cc6d67aa95d3d682ba6a0a (diff) | |
| download | adodb-c49e0065caad04307a025aa571d1246a92cbb891.tar.gz adodb-c49e0065caad04307a025aa571d1246a92cbb891.tar.bz2 adodb-c49e0065caad04307a025aa571d1246a92cbb891.zip | |
Fix errorMsg() when no connection on MySQL 8
MySQL 8 returns an object even if the client connection fails. This
causes ADOConnection_mysqli::errorMsg(), which expects the connection
object to be empty if there is no connection, to throw an error.
Fixes #842
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index bd5b3c34..80ca618a 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -1377,7 +1377,9 @@ class ADODB_mysqli extends ADOConnection { */ function ErrorMsg() { - if (empty($this->_connectionID)) + if (is_object($this->_connectionID) && isset ($this->_connectionID->error)) + $this->_errorMsg = $this->_connectionID->error; + else if (empty($this->_connectionID)) $this->_errorMsg = @mysqli_connect_error(); else $this->_errorMsg = @mysqli_error($this->_connectionID); |
