From a77ca74a7e3275e3aa9d9a3d0b5bb02b95ac3f24 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 29 Jun 2022 09:34:30 +1200 Subject: [PATCH] FIX Ensure not passing null to mysql methods for PHP 8.1 compatibility --- src/ORM/Connect/MySQLiConnector.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ORM/Connect/MySQLiConnector.php b/src/ORM/Connect/MySQLiConnector.php index 969359bbe77..b4ab7b697fe 100644 --- a/src/ORM/Connect/MySQLiConnector.php +++ b/src/ORM/Connect/MySQLiConnector.php @@ -151,7 +151,7 @@ public function __destruct() public function escapeString($value) { - return $this->dbConn->real_escape_string($value); + return $this->dbConn->real_escape_string($value ?? ''); } public function quoteString($value) @@ -181,7 +181,7 @@ public function query($sql, $errorLevel = E_USER_ERROR) $this->beforeQuery($sql); // Benchmark query - $handle = $this->dbConn->query($sql, MYSQLI_STORE_RESULT); + $handle = $this->dbConn->query($sql ?? '', MYSQLI_STORE_RESULT); if (!$handle || $this->dbConn->error) { $this->databaseError($this->getLastError(), $errorLevel, $sql); @@ -319,7 +319,7 @@ public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR) public function selectDatabase($name) { - if ($this->dbConn->select_db($name)) { + if ($this->dbConn->select_db($name ?? '')) { $this->databaseName = $name; return true; }