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

Files with classes that declare itself to be it's parent can cause an infinite loop when indexing. #669

Closed
d0x2f opened this issue Aug 31, 2018 · 6 comments · Fixed by #670

Comments

@d0x2f
Copy link
Contributor

d0x2f commented Aug 31, 2018

I noticed this happening often when a project had phan installed as a dependency.

As a minimal example, the server will enter an infinite loop trying to index this file:

<?php
class C extends C {}
$c = new C;
$c->undef_prop = 1;

PR to follow.

@tomterl
Copy link

tomterl commented Sep 21, 2018

I'm curious: The example code throws Fatal Errors with php7.2 and php7.3; I agree that it shouldn't cause infinite loops in a parser/language-server -- why such code would be written alludes me! Would you care/be so kind to elaborate?

@felixfbecker
Copy link
Owner

There is no reason. But it shouldn’t cause infinite loops

@d0x2f
Copy link
Contributor Author

d0x2f commented Sep 21, 2018

@tomterl In my case, a project I'm working on uses a dev dependency (phan) that includes code that's deliberately written to trigger an error among it's tests.

Furthermore, simply typing an error like this by mistake is plausible, especially given that VSCode and this extension supports live feedback as you type.

@felixfbecker
Copy link
Owner

@d0x2f you might wanna suggest to Phan to not ship tests in their package

@tomterl
Copy link

tomterl commented Sep 21, 2018

Now that I'm thinking about it, during typing this might easily occur (class C extends CBase...)

james2doyle pushed a commit to james2doyle/php-language-server that referenced this issue Oct 29, 2018
@felixfbecker
Copy link
Owner

🎉 This issue has been resolved in version 5.4.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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 a pull request may close this issue.

3 participants