1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-13 01:54:00 +02:00

Parse 'a\';' on webserver file separation

This commit is contained in:
Jakub Vrana
2011-08-04 23:49:38 +02:00
parent 323f4ab34c
commit f0d0bdbf39
2 changed files with 4 additions and 3 deletions

View 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;
}