From cd1d5de426061264b602944040613f2121eb1dce Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:19:46 +1300 Subject: [PATCH] FIX Throw DatabaseException, not mysqli_sql_exception (#11545) --- src/ORM/Connect/MySQLiConnector.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ORM/Connect/MySQLiConnector.php b/src/ORM/Connect/MySQLiConnector.php index 2fbbd70c5d1..dddb2d333e3 100644 --- a/src/ORM/Connect/MySQLiConnector.php +++ b/src/ORM/Connect/MySQLiConnector.php @@ -306,7 +306,12 @@ public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR) } // Safely execute the statement - $statement->execute(); + try { + $statement->execute(); + } catch (mysqli_sql_exception $e) { + $success = false; + $this->databaseError($e->getMessage(), E_USER_ERROR, $sql, $parameters); + } } if (!$success || $statement->error) {