Skip to content

Commit

Permalink
Merge pull request #286 from nabab/patch-1
Browse files Browse the repository at this point in the history
Prevent Undefined offset error
  • Loading branch information
greenlion committed Dec 23, 2018
2 parents 724fa89 + 6519c03 commit 249e834
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/PHPSQLParser/processors/SQLProcessor.php
Expand Up @@ -61,7 +61,11 @@ public function process($tokens) {
$skip_next = 0;
$out = false;

$tokenCount = count($tokens);
// $tokens may come as a numeric indexed array starting with an index greater than 0 (or as a boolean)
$tokenCount = count($tokens);
if ( is_array($tokens) ){
$tokens = array_values($tokens);
}
for ($tokenNumber = 0; $tokenNumber < $tokenCount; ++$tokenNumber) {

// https://github.com/greenlion/PHP-SQL-Parser/issues/279
Expand Down

0 comments on commit 249e834

Please sign in to comment.