Skip to content

Commit

Permalink
Use a regex to test for placeholders.
Browse files Browse the repository at this point in the history
This avoids false positives where `:c1` will match `:c14`
  • Loading branch information
markstory committed Mar 21, 2016
1 parent e1e6da6 commit ed358f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Database/QueryCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function compile(Query $query, ValueBinder $generator)
if ($query->valueBinder() !== $generator) {
foreach ($query->valueBinder()->bindings() as $binding) {
$placeholder = ':' . $binding['placeholder'];
if (strpos($sql, $placeholder) !== false) {
if (preg_match('/' . $placeholder . '(?:\W|$)/', $sql) > 0) {
$generator->bind($placeholder, $binding['value'], $binding['type']);
}
}
Expand Down

0 comments on commit ed358f0

Please sign in to comment.