Skip to content

Commit 34f9392

Browse files
authored
Merge pull request #13 from osindex/master
avoid vsprintf() error
2 parents 4b4d87a + 5540e59 commit 34f9392

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ServiceProvider.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ public function boot()
3232

3333
$bindings = $query->connection->prepareBindings($query->bindings);
3434
$pdo = $query->connection->getPdo();
35-
$realSql = vsprintf($sqlWithPlaceholders, array_map([$pdo, 'quote'], $bindings));
36-
$duration = $this->formatDuration($query->time / 1000);
35+
$realSql = $sqlWithPlaceholders;
36+
37+
if (count($bindings) > 0) {
38+
$realSql = vsprintf($sqlWithPlaceholders, array_map([$pdo, 'quote'], $bindings));
39+
}
3740

3841
Log::debug(sprintf('[%s] %s | %s: %s', $duration, $realSql, request()->method(), request()->getRequestUri()));
3942
});

0 commit comments

Comments
 (0)