TysonAndre / vscode-php-phan

Phan - PHP Static Analysis for VS Code
Other
24 stars 4 forks source link

Extension stopped working #8

Closed hworld closed 6 years ago

hworld commented 6 years ago

After the analyze on save branch being merged in, it doesn't seem to be working. I tried enabling debugging in the settings, but it's no longer showing in the extension Output tab. In the processlist it's showing up, though. When I run Phan manually it works.

This commit works for me just fine: 12b8bdda20d47fa0958f8eafdc2169c5d48af39a After that it's broken.

In master this is what shows up for "phan" in my processlist: php /home/ddecarmine/.vscode/extensions/TysonAndre.php-phan-0.0.9/vendor/phan/phan/phan --language-server-verbose --language-server-analyze-only-on-save --use-fallback-parser --language-server-tcp-connect=127.0.0.1:34873

Not sure how to help debug this. =\

TysonAndre commented 6 years ago

Could you post the output of php-config and php -m for the php installation being used?

It could be that TCP sockets aren't supported, or some other issue (failing to be non-blockinh, not working as intended due to fork(), etc.

TysonAndre commented 6 years ago

What OS and OS version are you using. What repo did you use for downloading PHP binaries and extensions?

TysonAndre commented 6 years ago

Also, what version of VS Code are you using? I'm using php 7.2.2 with VS Code 1.20.0.

"Help > Toggle Developer Tools" might bring up useful information or the debugging logs in the console (Similar to Google Chrome developer tools for javascript) (e.g. Right click and "Save as" and copy that to a gist)

Unlikely: If you're running php in docker or a virtualized environment, it wouldn't work.

hworld commented 6 years ago

Hey, sorry, should've put all my version info before.

OS: Fedora 27 PHP: 7.1.14 (installed locally, through the normal Fedora packages) VS Code: 1.19.3

php-config:

[ddecarmine@localhost gamejolt-build]$ php-config
Usage: /usr/bin/php-config [OPTION]
Options:
  --prefix            [/usr]
  --includes          [-I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib]
  --ldflags           []
  --libs              [-lcrypt   -lresolv -lcrypt -ledit -lncurses -lstdc++ -lz -lpcre -lrt -lm -ldl -lnsl  -lxml2 -lz -llzma -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcrypt -lcrypt ]
  --extension-dir     [/usr/lib64/php/modules]
  --include-dir       [/usr/include/php]
  --man-dir           [/usr/share/man]
  --php-binary        [/usr/bin/php]
  --php-sapis         [apache2handler embed fpm  cli phpdbg cgi]
  --configure-options [--build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-libdir=lib64 --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic --disable-rpath --without-pear --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --enable-gd-native-ttf --without-gdbm --with-jpeg-dir=/usr --with-openssl --with-system-ciphers --with-pcre-regex=/usr --with-zlib --with-layout=GNU --with-kerberos --with-libxml-dir=/usr --with-system-tzdata --with-mhash --enable-dtrace --libdir=/usr/lib64/php --enable-pcntl --enable-opcache --enable-opcache-file --enable-phpdbg --with-imap=shared --with-imap-ssl --enable-mbstring=shared --enable-mbregex --with-gd=shared,/usr --with-gmp=shared --enable-calendar=shared --enable-bcmath=shared --with-bz2=shared --enable-ctype=shared --enable-dba=shared --with-db4=/usr --with-tcadb=/usr --enable-exif=shared --enable-ftp=shared --with-gettext=shared --with-iconv=shared --enable-sockets=shared --enable-tokenizer=shared --with-xmlrpc=shared --with-ldap=shared --with-ldap-sasl --enable-mysqlnd=shared --with-mysqli=shared,mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-interbase=shared --with-pdo-firebird=shared --enable-dom=shared --with-pgsql=shared --enable-simplexml=shared --enable-xml=shared --enable-wddx=shared --with-snmp=shared,/usr --enable-soap=shared --with-xsl=shared,/usr --enable-xmlreader=shared --enable-xmlwriter=shared --with-curl=shared,/usr --enable-pdo=shared --with-pdo-odbc=shared,unixODBC,/usr --with-pdo-mysql=shared,mysqlnd --with-pdo-pgsql=shared,/usr --with-pdo-sqlite=shared,/usr --with-pdo-dblib=shared,/usr --with-sqlite3=shared,/usr --enable-json=shared --without-readline --with-libedit --with-pspell=shared --enable-phar=shared --with-mcrypt=shared,/usr --with-tidy=shared,/usr --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared --enable-shmop=shared --enable-posix=shared --with-unixODBC=shared,/usr --enable-fileinfo=shared --enable-intl=shared --with-icu-dir=/usr --with-enchant=shared,/usr --with-recode=shared,/usr build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu]
  --version           [7.1.14]
  --vernum            [70114]

php -m

[PHP Modules]
ast
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib
TysonAndre commented 6 years ago

https://ask.fedoraproject.org/en/question/9294/apache-php-sockets-not-working/

I've also seen turning off SELinux as a suggestion for fedora. Maybe PHP can't connect to arbitrary localhost TCP ports?

Will work on re-enabling the option to use stdin in the extension and adding a quick script to check if PHP cli can create and use sockets asynchronously

TysonAndre commented 6 years ago
  1. Upgrade to vscode-php-phan 0.0.10. Does the issue still happen?
  2. After upgrading to 0.0.10, add phan.connectToServerWithStdio: true, to the project's configuration. If the problem was caused by using TCP instead of STDIO, that should fix it.

Also, mentioned earlier:

"Help > Toggle Developer Tools" might bring up useful information or the debugging logs in the console (Similar to Google Chrome developer tools for javascript) (e.g. Right click and "Save as" and copy that to a gist)

Other possible causes:

hworld commented 6 years ago

It seems that was the issue! stdin works, the sockets don't. Flipping the option between on/off reproduces it. I have SELinux off, so that shouldn't be the issue. I wonder if the firewall is blocking even locally...

hworld commented 6 years ago

Tried disabling firewalld and same issue... I can try to keep digging in to see if errors crop up anywhere. Will report back here if I find anything in the future.