From dd85aa5d6a782cf079d3d71d67fec9fd284de7fb Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 29 Aug 2011 15:58:53 +0200 Subject: [PATCH] Error in case of found string at end of chunk (thanks to simonik) --- adminer/sql.inc.php | 9 +++++---- changes.txt | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index e4d135f5..cc98e5ec 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -73,12 +73,13 @@ if (!$error && $_POST) { if ($found && $found != $delimiter) { // find matching quote or comment end while (preg_match('(' . ($found == '/*' ? '\\*/' : ($found == '[' ? ']' : (ereg('^-- |^#', $found) ? "\n" : preg_quote($found) . "|\\\\."))) . '|$)s', $query, $match, PREG_OFFSET_CAPTURE, $offset)) { //! respect sql_mode NO_BACKSLASH_ESCAPES $s = $match[0][0]; - $offset = $match[0][1] + strlen($s); if (!$s && $fp && !feof($fp)) { - $offset -= strlen($found); // strlen($found) >= strlen("\\.") - 1 $query .= fread($fp, 1e5); - } elseif ($s[0] != "\\") { - break; + } else { + $offset = $match[0][1] + strlen($s); + if ($s[0] != "\\") { + break; + } } } } else { // end of a query diff --git a/changes.txt b/changes.txt index e6f24e28..0c0ccb45 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ Adminer 3.3.4-dev: Foreign keys default actions (bug #3397606) +Fix minor parser bug in SQL command with webserver file PostgreSQL: fix alter foreign key SET DEFAULT foreign key action PostgreSQL over PDO: connect if the eponymous database does not exist (bug #3391619)