From b4090284893f7ef83eca723eb52c012409cac02c Mon Sep 17 00:00:00 2001 From: Angel Date: Mon, 22 Jan 2024 09:40:06 +0800 Subject: [PATCH] [fix] generate() quote error with non-string value #1108 --- src/Medoo.php | 2 +- tests/UpdateTest.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Medoo.php b/src/Medoo.php index c3ee6813..b8cb0302 100644 --- a/src/Medoo.php +++ b/src/Medoo.php @@ -604,7 +604,7 @@ protected function generate(string $statement, array $map): string foreach ($map as $key => $value) { if ($value[1] === PDO::PARAM_STR) { - $replace = $this->quote($value[0]); + $replace = $this->quote("{$value[0]}"); } elseif ($value[1] === PDO::PARAM_NULL) { $replace = 'NULL'; } elseif ($value[1] === PDO::PARAM_LOB) { diff --git a/tests/UpdateTest.php b/tests/UpdateTest.php index c7c7112b..389cadf7 100644 --- a/tests/UpdateTest.php +++ b/tests/UpdateTest.php @@ -21,6 +21,7 @@ public function testUpdate($type) $this->database->update("account", [ "type" => "user", + "money" => 23.2, "age[+]" => 1, "level[-]" => 5, "score[*]" => 2, @@ -37,6 +38,7 @@ public function testUpdate($type) 'default' => << <<database->queryString);