fix: add unicode flag to named param regex for ö/ä chars
Column name yhteyshenkilö contains ö which \w doesn't match without the /u flag. This caused SQL syntax errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2
db.php
2
db.php
@@ -35,7 +35,7 @@ function _dbRun(string $sql, array $params = []): mysqli_stmt {
|
||||
// Muunna nimetyt parametrit (:name) positiivisiksi (?)
|
||||
if (!empty($params) && !array_is_list($params)) {
|
||||
$ordered = [];
|
||||
$sql = preg_replace_callback('/:(\w+)/', function($m) use ($params, &$ordered) {
|
||||
$sql = preg_replace_callback('/:(\w+)/u', function($m) use ($params, &$ordered) {
|
||||
$key = $m[1];
|
||||
$ordered[] = array_key_exists($key, $params) ? $params[$key] : null;
|
||||
return '?';
|
||||
|
||||
Reference in New Issue
Block a user