From c274a8fc7f8f0a012e8c535eab976af01d6e106b Mon Sep 17 00:00:00 2001 From: tianhe1986 Date: Fri, 28 Oct 2016 18:43:30 +0800 Subject: Match both single and double quote in compile_binds(). Signed-off-by: tianhe1986 --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 43e8eeac6..465d8db7b 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -938,7 +938,7 @@ abstract class CI_DB_driver { $ml = strlen($this->bind_marker); // Make sure not to replace a chunk inside a string that happens to match the bind marker - if ($c = preg_match_all("/'[^']*'/i", $sql, $matches)) + if ($c = preg_match_all("/(['\"])[^\\1]*\\1/i", $sql, $matches)) { $c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', str_replace($matches[0], -- cgit v1.2.3-24-g4f1b From eef5951ae313c2c4080e94b8c1aa743a6d6c93b7 Mon Sep 17 00:00:00 2001 From: tianhe1986 Date: Fri, 28 Oct 2016 18:48:35 +0800 Subject: Match single quote in is_write_type(). Signed-off-by: tianhe1986 --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 465d8db7b..a9a3f29e5 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -982,7 +982,7 @@ abstract class CI_DB_driver { */ public function is_write_type($sql) { - return (bool) preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|REINDEX)\s/i', $sql); + return (bool) preg_match('/^\s*["\']?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|REINDEX)\s/i', $sql); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From e791c2dd5112594d423342ceb29d6586acdffba3 Mon Sep 17 00:00:00 2001 From: tianhe1986 Date: Sat, 29 Oct 2016 01:47:23 +0800 Subject: Revert "Match single quote in is_write_type()." This reverts commit eef5951ae313c2c4080e94b8c1aa743a6d6c93b7. Signed-off-by: tianhe1986 --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index a9a3f29e5..465d8db7b 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -982,7 +982,7 @@ abstract class CI_DB_driver { */ public function is_write_type($sql) { - return (bool) preg_match('/^\s*["\']?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|REINDEX)\s/i', $sql); + return (bool) preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|REINDEX)\s/i', $sql); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b