Skip to content

Commit

Permalink
Force value as string Fixes #1284
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh authored Feb 8, 2022
1 parent c90b0f7 commit bafb390
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DataCollector/QueryCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function addQuery($query, $bindings, $time, $connection)
if (!is_int($binding) && !is_float($binding)) {
if ($pdo) {
try {
$binding = $pdo->quote($binding);
$binding = $pdo->quote((string) $binding);
} catch (\Exception $e) {
$binding = $this->emulateQuote($binding);
}
Expand Down Expand Up @@ -211,7 +211,7 @@ protected function emulateQuote($value)
$search = ["\\", "\x00", "\n", "\r", "'", '"', "\x1a"];
$replace = ["\\\\","\\0","\\n", "\\r", "\'", '\"', "\\Z"];

return "'" . str_replace($search, $replace, $value) . "'";
return "'" . str_replace($search, $replace, (string) $value) . "'";
}

/**
Expand Down

0 comments on commit bafb390

Please sign in to comment.