Skip to content

Commit

Permalink
Fail connection if mysqlnd is not available
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dregad committed May 24, 2023
1 parent e631bd9 commit 39f0c31
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/adodb-mysqli.inc.php
Expand Up @@ -167,6 +167,14 @@ function _connect($argHostname = null,
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)) {
Expand Down

0 comments on commit 39f0c31

Please sign in to comment.