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

Crash when parsing MadelineProto #2932

Closed
danog opened this issue Mar 7, 2020 · 5 comments
Closed

Crash when parsing MadelineProto #2932

danog opened this issue Mar 7, 2020 · 5 comments
Labels

Comments

@danog
Copy link
Collaborator

danog commented Mar 7, 2020

psalm seems to crash when parsing my main project, MadelineProto.
I would love to help localizing the exact source of the issue, but I can't quite understand what file is causing it.
Here are the single-threaded debug and debug-line outputs of psalm with the thrown exception.

@psalm-github-bot
Copy link

Hey @danog, can you reproduce the issue on https://psalm.dev ?

@danog
Copy link
Collaborator Author

danog commented Mar 7, 2020

Hi there friendly bot, would love to, but I can't quite figure out what is causing it.
When trying to parse src/danog/MadelineProto/MTProto.php, psalm.dev crashes with an Internal Psalm error on line undefined - undefined.

@weirdan
Copy link
Collaborator

weirdan commented Mar 7, 2020

https://psalm.dev/r/62b20c86b6 - this reproduces the crash indicated by the debug-by-line link in the ticket description
Edit: simplified it even further

@psalm-github-bot
Copy link

psalm-github-bot bot commented Mar 7, 2020

I found these snippets:

https://psalm.dev/r/62b20c86b6
<?php
  !\is_callable($loop_callback) || 
  \is_array($loop_callback) && 
  !\method_exists(...$loop_callback);
Psalm encountered an internal error:

/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php: Argument 2 passed to Psalm\Internal\Analyzer\Statements\Expression\CallAnalyzer::checkFunctionArgumentType() must be an instance of Psalm\Type\Union, null given, called in /vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php on line 2052

@danog
Copy link
Collaborator Author

danog commented Mar 7, 2020

Great, you found the issue! ❤️
I guess I don't need that legacy condition after all, since is_callable works with array class callables anyway.

P. S.
BTW, Sorry for the ugly lack of parenthesis, recently did a mass refactor with php-parser that removed some unnecessary brackets.

@weirdan weirdan added the bug label Mar 7, 2020
@muglug muglug closed this as completed in 3c41648 Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants