Gert-dev / php-ide-serenata

Atom IDE package that integrates the Serenata server to provide PHP code assistance
https://serenata.gitlab.io/
Other
275 stars 22 forks source link

[5.0.1] Could not open input file - php-ide-serenata/distribution.phar/builds/Serenata/Serenata/src/Main.php #484

Closed lcharette closed 4 years ago

lcharette commented 4 years ago

Serenata doesn't work at all since upgrading from 4.x to 5.0.1.

Console shows this error :

The PHP server has something to say: Could not open input file: phar:///Users/malou/Library/Preferences/php-ide-serenata/distribution.phar/builds/Serenata/Serenata/src/Main.php

distribution.phar/builds/Serenata/Serenata/src/Main.php does exist.

/Users/malou/.atom/packages/php-ide-serenata/lib/Proxy.js:86 Serenata unexpectedly closed. Either something caused the process to stop, it crashed, or the socket closed. In case of the first two, you should see additional output indicating this is the case and you can report a bug. If there is no additional output, you may be missing the right dependencies or extensions or the server may have run out of memory (you can increase it via the settings screen).

See attached log when restarting Serenata (same with re-index, etc.). Same with every project / actions : Serenata-Restart.log

I did a fresh install of php-ide-serenata and redownloaded the phar.

lcharette commented 4 years ago

This issue was using PHP 7.1 on macOS Mojave.

Updated to MacOS Catalyna today, which come with PHP 7.3 and the problem is solved ‾_(ツ)_/‾

Gert-dev commented 4 years ago

Hmm, strange. There are Serenata builds supporting each PHP version and tests are run with each version separately, but some files are not included in the tests (such as Main.php), perhaps I accidentally used a PHP 7.3-ism somewhere, such as a trailing comma in a function call.

Since this issue is fixed, I'll close this, but thanks for letting me know what solved the problem, it may be related to #483 as well.

lcharette commented 4 years ago

FYI, before the fix, I did try manually replacing the PHAR from the one for PHP 7.1 on Serenata repo. It was the same issue. Could have been Atom downloaded the wrong version, as the serenata config in my project was showing 7.3 as the PHP version (which is probably the default value).

Gert-dev commented 4 years ago

Yes, the project configuration always generates PHP version 7.3, regardless of server version (as this is the latest), but this setting isn't really used anywhere in Serenata itself yet.

The version that is downloaded is stored in ServerManager and currently targets the PHP 7.1 version, so that should be fine.

albert200000 commented 4 years ago

I have the same error on Ubuntu 18.04 with php 7.2 but on openSUSE 15.1 its working fine. What the difference?

lcharette commented 4 years ago

Looks like the issue is back. It seams like an issue with Xdebug. Mac OS Catalina nuked my Xdebug support. I finally managed to re-enable it, but now the issue is back.

albert200000 commented 4 years ago

Indeed, I've installed xdebug on openSUSE and the issue appeared.

Gert-dev commented 4 years ago

Hmmm, it is interesting you should mention that. Serenata contains code that causes it to restart itself if you have Xdebug loaded (because Xdebug slows the server down and you probably want it for your own development, not Serenata itself).

This is done via the xdebug-handler. It is possible it doesn't handle PHARs well, though Composer itself is also a PHAR, so I could be wrong.

Gert-dev commented 4 years ago

It was indeed due to Xdebug and me explicitly setting the path for the script it had to start. This will be fixed in the upcoming 5.1.0 release of Serenata.

Thanks for tipping me on Xdebug!

Gert-dev commented 4 years ago

I've released v5.1.0 of this package, which uses Serenata 5.1.0, which should fix the issue. Thanks for helping to track it down!