You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple query like this: $tmp = $this->query("SELECT :sth", [':sth' => 'abc']); is causing an exception now.
system/Database/Query.php->matchNamedBinds L: 421
Looks like query binding stopped working because of someone commented that line: // $sql = preg_replace('|:' . $placeholder . '(?!\w)|', $escapedValue, $sql);
and there is also one missing char:
Ok it works if we are binding like this: SELECT :sth: instead of SELECT :sth .
So I think documentation should be updated (https://bcit-ci.github.io/CodeIgniter4/database/queries.html#query-bindings) or someone add one unnecessary ":" at the end: $replacers[":{$placeholder}:"] = $escapedValue;
after placeholder.
The text was updated successfully, but these errors were encountered:
TL;DR;
https://bcit-ci.github.io/CodeIgniter4/database/queries.html#query-bindings should be updated.
Simple query like this:
$tmp = $this->query("SELECT :sth", [':sth' => 'abc']);
is causing an exception now.system/Database/Query.php->matchNamedBinds L: 421
Looks like query binding stopped working because of someone commented that line:
// $sql = preg_replace('|:' . $placeholder . '(?!\w)|', $escapedValue, $sql);
and there is also one missing char:
$sql = preg_replace('|:' . $placeholder . '(?!\w):|', $escapedValue, $sql);
UPDATE
Ok it works if we are binding like this:
SELECT :sth:
instead ofSELECT :sth
.So I think documentation should be updated (https://bcit-ci.github.io/CodeIgniter4/database/queries.html#query-bindings) or someone add one unnecessary ":" at the end:
$replacers[":{$placeholder}:"] = $escapedValue;
after placeholder.
The text was updated successfully, but these errors were encountered: