Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7.4.10 Trying to access array offset on value of type null #390

Closed
cminovici opened this issue Dec 17, 2020 · 0 comments
Closed

PHP 7.4.10 Trying to access array offset on value of type null #390

cminovici opened this issue Dec 17, 2020 · 0 comments

Comments

@cminovici
Copy link

cminovici commented Dec 17, 2020

Hello,

Stack:

  • PHP 7.4.10
  • doctrine/annotations : 1.11.1
  • doctrine/orm : v2.6.3
  • symfony/symfony: v4.4.17

Just upgraded PHP from 7.3.9 to 7.4.10 and I get the following err "Trying to access array offset on value of type null" when using LIKE syntax inside DQL where condition.

image

And I get

image

vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php:3195

        if ($this->lexer->lookahead['type'] === Lexer::T_ESCAPE) {
            $this->match(Lexer::T_ESCAPE);
            $this->match(Lexer::T_STRING);

            $escapeChar = new AST\Literal(AST\Literal::STRING, $this->lexer->token['value']);
        }

Solution is to proper check if isset

        if (isset($this->lexer->lookahead['type']) && $this->lexer->lookahead['type'] === Lexer::T_ESCAPE) {
            $this->match(Lexer::T_ESCAPE);
            $this->match(Lexer::T_STRING);

            $escapeChar = new AST\Literal(AST\Literal::STRING, $this->lexer->token['value']);
        }

Related to #273

Can you help us check? I can help with fix

Thanks

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

No branches or pull requests

1 participant