Merge pull request #10377 from creative-commoners/pulls/4.11/mysql-null

FIX Ensure not passing null to mysql methods for PHP 8.1 compatibility
This commit is contained in:
Guy Sartorelli 2022-06-29 10:01:12 +12:00 committed by GitHub
commit 01c27e69de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,7 +151,7 @@ class MySQLiConnector extends DBConnector
public function escapeString($value) public function escapeString($value)
{ {
return $this->dbConn->real_escape_string($value); return $this->dbConn->real_escape_string($value ?? '');
} }
public function quoteString($value) public function quoteString($value)
@ -181,7 +181,7 @@ class MySQLiConnector extends DBConnector
$this->beforeQuery($sql); $this->beforeQuery($sql);
// Benchmark query // Benchmark query
$handle = $this->dbConn->query($sql, MYSQLI_STORE_RESULT); $handle = $this->dbConn->query($sql ?? '', MYSQLI_STORE_RESULT);
if (!$handle || $this->dbConn->error) { if (!$handle || $this->dbConn->error) {
$this->databaseError($this->getLastError(), $errorLevel, $sql); $this->databaseError($this->getLastError(), $errorLevel, $sql);
@ -319,7 +319,7 @@ class MySQLiConnector extends DBConnector
public function selectDatabase($name) public function selectDatabase($name)
{ {
if ($this->dbConn->select_db($name)) { if ($this->dbConn->select_db($name ?? '')) {
$this->databaseName = $name; $this->databaseName = $name;
return true; return true;
} }