From bc6e1d0db188cfd535061d1040d3e75d2fd90483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaz=C4=B1m=20=C3=96lmez?= Date: Wed, 30 Apr 2025 04:29:18 +0300 Subject: [PATCH] Fix Error: Uncaught TypeError: Argument 1 passed Fix in error: Fatal error: Uncaught TypeError: Argument 1 passed to ezsql\Database\ez_pdo::escape() must be of the type string, null given, called in /var/www/vendor/ezsql/ezsql/lib/ezQuery.php on line 633 and defined in /var/www/vendor/ezsql/ezsql/lib/Database/ez_pdo.php:173 Stack trace: #0 /var/www/vendor/ezsql/ezsql/lib/ezQuery.php(633): ezsql\Database\ez_pdo->escape(NULL) #1 /var/www/ajax.php(478): ezsql\ezQuery->update('restaurant', Array, Array) #2 {main} thrown in /var/www/vendor/ezsql/ezsql/lib/Database/ez_pdo.php on line 173 --- lib/ezQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ezQuery.php b/lib/ezQuery.php index 21fccb3d..4d0ff831 100644 --- a/lib/ezQuery.php +++ b/lib/ezQuery.php @@ -622,7 +622,7 @@ public function update(string $table = null, $keyValue, ...$whereConditions) $sql = "UPDATE $table SET "; foreach ($keyValue as $key => $val) { - if (\strtolower($val) == 'null') { + if (is_null($val) || \strtolower($val) == 'null') { $sql .= "$key = NULL, "; } elseif (\in_array(\strtolower($val), array('current_timestamp()', 'date()', 'now()'))) { $sql .= "$key = CURRENT_TIMESTAMP(), ";