Skip to content

Commit 469666d

Browse files
fix: "Undefined offset: 0" for backtick delimiters and address related issues (#995, #967, #928)
This commit fixes the "Undefined offset: 0" error that occurred in the rawAddPrefix function when using backtick delimiters for table names in SQL queries. It also addresses issues reported in tickets #995, #967, and #928, which were likely related to the same underlying problem with table name identification. Changes: Updated the regular expression in rawAddPrefix to match backtick characters (\) as valid delimiters for table names. This fix ensures that the function correctly identifies and prefixes table names regardless of the delimiter used.
1 parent c740505 commit 469666d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

MysqliDb.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ private function queryUnprepared($query)
553553
public function rawAddPrefix($query){
554554
$query = str_replace(PHP_EOL, '', $query);
555555
$query = preg_replace('/\s+/', ' ', $query);
556-
preg_match_all("/(from|into|update|join|describe) [\\'\\´]?([a-zA-Z0-9_-]+)[\\'\\´]?/i", $query, $matches);
556+
preg_match_all("/(from|into|update|join|describe) [\\'\\´\\`]?([a-zA-Z0-9_-]+)[\\'\\´\\`]?/i", $query, $matches);
557557
list($from_table, $from, $table) = $matches;
558558

559559
// Check if there are matches

0 commit comments

Comments
 (0)