Skip to content

Commit

Permalink
Fixed a bug where MySQL and MySQLi Classes modifies SQL statement aft…
Browse files Browse the repository at this point in the history
…er incorrectly assuming it is creating a table (issue #652).
  • Loading branch information
mystralkk committed Jan 19, 2016
1 parent e5c2323 commit dec6623
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion system/databases/mysql.class.php
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion system/databases/mysqli.class.php
Expand Up @@ -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) {
Expand Down

0 comments on commit dec6623

Please sign in to comment.