From 2f5d7f2b0ede67973ae2631ff04b0b89cd48a07c Mon Sep 17 00:00:00 2001 From: Cassiano Rafael <110979114+CassianoRafael@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:46:52 -0300 Subject: [PATCH] Fix potential null issue in rawAddPrefix method --- MysqliDb.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MysqliDb.php b/MysqliDb.php index ab88d03..17bf8ae 100644 --- a/MysqliDb.php +++ b/MysqliDb.php @@ -556,6 +556,10 @@ public function rawAddPrefix($query){ preg_match_all("/(from|into|update|join|describe) [\\'\\´]?([a-zA-Z0-9_-]+)[\\'\\´]?/i", $query, $matches); list($from_table, $from, $table) = $matches; + // Check if there are matches + if (empty($table[0])) + return $query; + return str_replace($table[0], self::$prefix.$table[0], $query); }