From e189cc14e07f92f6f73bf5356d12cb07d4218797 Mon Sep 17 00:00:00 2001 From: guanguans Date: Wed, 26 Jul 2023 18:21:44 +0800 Subject: [PATCH] fix `PDO::quote(): Passing null to parameter #1 ($string) of type string is deprecated` in PHP8.1 --- src/ServiceProvider.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index bb068df..118b393 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -45,7 +45,10 @@ public function boot() $duration = $this->formatDuration($query->time / 1000); if (count($bindings) > 0) { - $realSql = vsprintf($sqlWithPlaceholders, array_map([$pdo, 'quote'], $bindings)); + $realSql = vsprintf($sqlWithPlaceholders, array_map( + static fn($binding) => $binding === null ? 'NULL' : $pdo->quote($binding), + $bindings + )); } Log::channel(config('logging.query.channel', config('logging.default'))) ->debug(sprintf('[%s] [%s] %s | %s: %s', $query->connection->getDatabaseName(), $duration, $realSql,