From 680c8735c125d36fd30aa6b5a637411f5679dd48 Mon Sep 17 00:00:00 2001 From: Zag Date: Thu, 14 May 2026 15:32:10 +0100 Subject: [PATCH] Handle empty parameters in prepared statement execution Add check for empty parameters before executing statement. query_prepared() now safely executes queries with no bound params instead of crashing on empty bind_param() types --- lib/Database/ez_mysqli.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/Database/ez_mysqli.php b/lib/Database/ez_mysqli.php index 9ea0ff9..818a3e6 100644 --- a/lib/Database/ez_mysqli.php +++ b/lib/Database/ez_mysqli.php @@ -288,6 +288,15 @@ public function query_prepared(string $query, ?array $param = null) return false; } + if (empty($param)) { + $result = ($stmt->execute()) ? $this->fetch_prepared_result($stmt, $query) : false; + + $stmt->free_result(); + $stmt->close(); + + return $result; + } + $params = []; $types = \array_reduce( $param,