Skip to content

Commit

Permalink
BaseDriver: fixed error when there were comments at the end of file
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik committed Jan 27, 2017
1 parent 1818cce commit 5dd5e4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Drivers/BaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function loadFile($path)
$queries = 0;

$space = "(?:\\s|/\\*.*\\*/|(?:#|-- )[^\\n]*\\n|--\\n)";
$spacesRe = "~^{$space}*\\z~";
$delimiter = ';';
$delimiterRe = "~^{$space}*DELIMITER\\s+(\\S+)~i";

Expand Down Expand Up @@ -103,7 +104,7 @@ public function loadFile($path)
}

} else { // last query or EOF
if (rtrim(substr($content, $queryOffset)) === '') {
if (preg_match($spacesRe, substr($content, $queryOffset))) {
break 2;

} else {
Expand Down

0 comments on commit 5dd5e4d

Please sign in to comment.