]> git.joonet.de Git - adminer.git/commitdiff
Parse 'a\';' on webserver file separation
authorJakub Vrana <jakub@vrana.cz>
Thu, 4 Aug 2011 21:49:38 +0000 (23:49 +0200)
committerJakub Vrana <jakub@vrana.cz>
Thu, 4 Aug 2011 21:49:38 +0000 (23:49 +0200)
adminer/sql.inc.php
changes.txt

index 090d3e5a81b5064c02a8fc9ac7fb90b1ebbcf0d1..eb0510a5b3cbfe5bd9b5f5d960afd3fee2447e1f 100644 (file)
@@ -63,19 +63,19 @@ if (!$error && $_POST) {
                        } else {
                                preg_match('(' . preg_quote($delimiter) . "|$parse)", $query, $match, PREG_OFFSET_CAPTURE, $offset); // should always match
                                $found = $match[0][0];
-                               $offset = $match[0][1] + strlen($found);
                                if (!$found && $fp && !feof($fp)) {
                                        $query .= fread($fp, 1e5);
                                } else {
+                                       $offset = $match[0][1] + strlen($found);
                                        if (!$found && rtrim($query) == "") {
                                                break;
                                        }
                                        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);
+                                                       $offset = $match[0][1] + ($s ? strlen($s) : -strlen($found)); // strlen($found) is higher than length of longest pattern minus one
                                                        if (!$s && $fp && !feof($fp)) {
-                                                               $query .= fread($fp, 1e6);
+                                                               $query .= fread($fp, 1e5);
                                                        } elseif ($s[0] != "\\") {
                                                                break;
                                                        }
index cf1fc49a5c795bd6bc1b321c524de4f195ba67cb..592cfd69e106d0a0f147785ff7555fa02a64b1d9 100644 (file)
@@ -1,5 +1,6 @@
 Adminer 3.3.2-dev:
 Display error with non-existent row in edit
+Fix minor parser bug in SQL command with webserver file
 Don't scroll with AJAX select order and alter move column
 Fast number of rows with big tables (PostgreSQL)
 Sort databases and schemas (PostgreSQL)