Skip to content

Conversation

@LeSuisse
Copy link
Contributor

Issue can be reproduced with the following code snippet:

new \PhpMyAdmin\SqlParser\Parser('SELECT a CASE');
// PHP Warning:  count(): Parameter must be an array or an object that implements Countable in src/Components/CaseExpression.php on line 296
// PHP Warning:  count(): Parameter must be an array or an object that implements Countable in src/Components/CaseExpression.php on line 297

Issue can be reproduced with the following code snippet:
```php
new \PhpMyAdmin\SqlParser\Parser('SELECT a CASE');
// PHP Warning:  count(): Parameter must be an array or an object that implements Countable in src/Components/CaseExpression.php on line 296
// PHP Warning:  count(): Parameter must be an array or an object that implements Countable in src/Components/CaseExpression.php on line 297
```
@codecov
Copy link

codecov bot commented Apr 10, 2019

Codecov Report

Merging #241 into master will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master     #241   +/-   ##
=========================================
  Coverage     99.63%   99.63%           
  Complexity     1849     1849           
=========================================
  Files            61       61           
  Lines          4118     4118           
=========================================
  Hits           4103     4103           
  Misses           15       15

Copy link
Member

@devenbansod devenbansod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💯

@ibennetch
Copy link
Member

I'm a little unsure about this because it doesn't seem to have fixed anything with the command line interface:

$ ./bin/highlight-query --query 'SELECT a CASE;'
SELECT
    a CASE;
$  ./bin/lint-query --query 'SELECT a CASE;'
#1: Unexpected end of CASE expression (near "" at position 0)

@LeSuisse
Copy link
Contributor Author

LeSuisse commented May 5, 2019

The PHP warnings have been fixed.

Without this contribution:

$ ./bin/lint-query --query 'SELECT a CASE;'
PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /home/thomas/Workspace/PHP/sql-parser/src/Components/CaseExpression.php on line 296
PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /home/thomas/Workspace/PHP/sql-parser/src/Components/CaseExpression.php on line 297
#1: Unexpected end of CASE expression (near "" at position 0)

With this contribution:

$ ./bin/lint-query --query 'SELECT a CASE;'
#1: Unexpected end of CASE expression (near "" at position 0)

This change is very similar to other fixes like the one done in 2b3fb2e

@ibennetch
Copy link
Member

Yes, this makes sense now. Good job.

I was initially testing with PHP 7.1 which does not give the warning, but with PHP 7.3 I see the same results you do.

Merging this, thanks for your contribution.

@ibennetch ibennetch merged commit a7c5771 into phpmyadmin:master May 5, 2019
ibennetch added a commit that referenced this pull request May 5, 2019
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants