Skip to content

Commit e189cc1

Browse files
authored
fix PDO::quote(): Passing null to parameter #1 ($string) of type string is deprecated in PHP8.1
1 parent f9cf0b6 commit e189cc1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ServiceProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ public function boot()
4545
$duration = $this->formatDuration($query->time / 1000);
4646

4747
if (count($bindings) > 0) {
48-
$realSql = vsprintf($sqlWithPlaceholders, array_map([$pdo, 'quote'], $bindings));
48+
$realSql = vsprintf($sqlWithPlaceholders, array_map(
49+
static fn($binding) => $binding === null ? 'NULL' : $pdo->quote($binding),
50+
$bindings
51+
));
4952
}
5053
Log::channel(config('logging.query.channel', config('logging.default')))
5154
->debug(sprintf('[%s] [%s] %s | %s: %s', $query->connection->getDatabaseName(), $duration, $realSql,

0 commit comments

Comments
 (0)