Skip to content

Commit d781531

Browse files
Vmak11barryvdh
authored andcommitted
Mimic bindValue and only quote non-integer and non-float data type (barryvdh#868)
1 parent e32e130 commit d781531

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/DataCollector/QueryCollector.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ public function addQuery($query, $bindings, $time, $connection)
109109
$regex = is_numeric($key)
110110
? "/\?(?=(?:[^'\\\']*'[^'\\\']*')*[^'\\\']*$)/"
111111
: "/:{$key}(?=(?:[^'\\\']*'[^'\\\']*')*[^'\\\']*$)/";
112-
$query = preg_replace($regex, $pdo->quote($binding), $query, 1);
112+
113+
// Mimic bindValue and only quote non-integer and non-float data types
114+
if (!is_int($binding) && !is_float($binding)) {
115+
$binding = $pdo->quote($binding);
116+
}
117+
118+
$query = preg_replace($regex, $binding, $query, 1);
113119
}
114120
}
115121

0 commit comments

Comments
 (0)