From 2b83016a2be63db8659d5094fea705484aa28c11 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 1 Jul 2024 17:50:12 +0200 Subject: [PATCH] fix(db): TooManyArguments: Too many arguments for method `Doctrine\DBAL\Statement::executeQuery()` Signed-off-by: Joas Schilling --- lib/private/DB/PreparedStatement.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/private/DB/PreparedStatement.php b/lib/private/DB/PreparedStatement.php index 9ff02c105e3..00a32a629f7 100644 --- a/lib/private/DB/PreparedStatement.php +++ b/lib/private/DB/PreparedStatement.php @@ -66,7 +66,17 @@ class PreparedStatement implements IPreparedStatement { } public function execute($params = null): IResult { - return ($this->result = new ResultAdapter($this->statement->executeQuery($params))); + if ($params !== null) { + foreach ($params as $key => $param) { + if (is_int($key)) { + // Parameter count starts with 1 + $this->bindValue($key + 1, $param); + } else { + $this->bindValue($key, $param); + } + } + } + return ($this->result = new ResultAdapter($this->statement->executeQuery())); } public function rowCount(): int {