avoid clever key manipulation, all we need are incremental numbers starting at 1

This commit is contained in:
El RIDO 2024-10-25 06:58:05 +02:00
parent cf83e3825f
commit e468f07626

View File

@ -506,8 +506,8 @@ class Database extends AbstractData
private function _exec($sql, array $params) private function _exec($sql, array $params)
{ {
$statement = $this->_db->prepare($sql); $statement = $this->_db->prepare($sql);
foreach ($params as $key => &$parameter) { $position = 1;
$position = $key + 1; foreach ($params as &$parameter) {
if (is_int($parameter)) { if (is_int($parameter)) {
$statement->bindParam($position, $parameter, PDO::PARAM_INT); $statement->bindParam($position, $parameter, PDO::PARAM_INT);
} elseif (is_string($parameter) && strlen($parameter) >= 4000) { } elseif (is_string($parameter) && strlen($parameter) >= 4000) {
@ -515,6 +515,7 @@ class Database extends AbstractData
} else { } else {
$statement->bindParam($position, $parameter); $statement->bindParam($position, $parameter);
} }
++$position;
} }
$result = $statement->execute(); $result = $statement->execute();
$statement->closeCursor(); $statement->closeCursor();