summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Regad <dregad@mantisbt.org>2023-05-12 17:52:55 +0200
committerDamien Regad <dregad@mantisbt.org>2023-05-24 12:03:03 +0200
commit39f0c31b6fa5a12ee346797cd75cd65c5780850d (patch)
tree13b15a061d4a6a06e76a513ab1387571c5891811
parente631bd9cef081f7e235bb90b9db17440e20d4f58 (diff)
downloadadodb-39f0c31b6fa5a12ee346797cd75cd65c5780850d.tar.gz
adodb-39f0c31b6fa5a12ee346797cd75cd65c5780850d.tar.bz2
adodb-39f0c31b6fa5a12ee346797cd75cd65c5780850d.zip
Fail connection if mysqlnd is not available
Since 5.22.0, the mysqli driver relies on the mysqli_stmt_get_result() function, which is only available in the MySQL Native Driver, to execute queries. An attempt to connect on a system using libmysqlclient should fail with an error message, to avoid problems down the line. Fixes #967
-rw-r--r--drivers/adodb-mysqli.inc.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php
index 07b294ca..5271db17 100644
--- a/drivers/adodb-mysqli.inc.php
+++ b/drivers/adodb-mysqli.inc.php
@@ -167,6 +167,14 @@ class ADODB_mysqli extends ADOConnection {
if(!extension_loaded("mysqli")) {
return null;
}
+ // Check for a function that only exists in mysqlnd
+ if (!function_exists('mysqli_stmt_get_result')) {
+ // @TODO This will be treated as if the mysqli extension were not available
+ // This could be misleading, so we output an additional error message.
+ // We should probably throw a specific exception instead.
+ $this->outp("MySQL Native Driver (msqlnd) required");
+ return null;
+ }
$this->_connectionID = @mysqli_init();
if (is_null($this->_connectionID)) {