Description
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 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.
Activity