summaryrefslogtreecommitdiffstats
path: root/src/Utils/BufferedQuery.php
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2016-03-02 13:41:25 +0100
committerMichal Čihař <michal@cihar.com>2016-03-02 13:43:42 +0100
commitd2e37de1dbec251556f35712bddcd61d24baaee6 (patch)
treedb4b752477439b917532c445969503d4efebbe2a /src/Utils/BufferedQuery.php
parentcf246a37afde716c8d7adeba7bffcdad86ac7ccf (diff)
downloadsql-parser-d2e37de1dbec251556f35712bddcd61d24baaee6.zip
sql-parser-d2e37de1dbec251556f35712bddcd61d24baaee6.tar.gz
sql-parser-d2e37de1dbec251556f35712bddcd61d24baaee6.tar.bz2
Fix splitting query when escaped quotes are involved
Fixes https://github.com/phpmyadmin/phpmyadmin/issues/12054 Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'src/Utils/BufferedQuery.php')
-rw-r--r--src/Utils/BufferedQuery.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Utils/BufferedQuery.php b/src/Utils/BufferedQuery.php
index 1aaa9d7..500862a 100644
--- a/src/Utils/BufferedQuery.php
+++ b/src/Utils/BufferedQuery.php
@@ -209,14 +209,14 @@ class BufferedQuery
*/
if ($this->status === static::STATUS_STRING_SINGLE_QUOTES) {
// Single-quoted strings like 'foo'.
- if ($this->query[$i] === '\'') {
+ if ($this->query[$i] === '\'' && $this->query[$i - 1] !== '\\') {
$this->status = 0;
}
$this->current .= $this->query[$i];
continue;
} elseif ($this->status === static::STATUS_STRING_DOUBLE_QUOTES) {
// Double-quoted strings like "bar".
- if ($this->query[$i] === '"') {
+ if ($this->query[$i] === '"' && $this->query[$i - 1] !== '\\') {
$this->status = 0;
}
$this->current .= $this->query[$i];