From dec662382ee3209968f59ebad90669ad5664df36 Mon Sep 17 00:00:00 2001 From: Kenji ITO Date: Tue, 19 Jan 2016 20:50:16 +0900 Subject: [PATCH] Fixed a bug where MySQL and MySQLi Classes modifies SQL statement after incorrectly assuming it is creating a table (issue #652). --- system/databases/mysql.class.php | 2 +- system/databases/mysqli.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/databases/mysql.class.php b/system/databases/mysql.class.php index 5133370cd..c2a247525 100755 --- a/system/databases/mysql.class.php +++ b/system/databases/mysql.class.php @@ -277,7 +277,7 @@ function dbQuery($sql,$ignore_errors=0) } // Modifies "CREATE TABLE" SQL - if (preg_match('/create\s+table\s/i', $sql)) { + if (preg_match('/^\s*create\s\s*table\s/i', $sql)) { $p = strrpos($sql, ')'); if ($p !== FALSE) { diff --git a/system/databases/mysqli.class.php b/system/databases/mysqli.class.php index 62c60d1fb..945b7792c 100644 --- a/system/databases/mysqli.class.php +++ b/system/databases/mysqli.class.php @@ -241,7 +241,7 @@ public function dbQuery($sql, $ignore_errors=0) } // Modifies "CREATE TABLE" SQL - if (preg_match('/create\s+table\s/i', $sql)) { + if (preg_match('/^\s*create\s\s*table\s/i', $sql)) { $p = strrpos($sql, ')'); if ($p !== FALSE) {