xcwen / ac-php

emacs auto-complete & company-mode for php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php 8 / how to update phpcttags

rotdrop opened this issue · comments

Hi,

thank you for your package! I have a question: the bundled phpctags does not seem to support php8, while the underlying https://github.com/nikic/PHP-Parser seems to support php8 already. However, it is not clear how the bundled phpctags was modified? Is there a way update the phpctags from the upstream version?

Thank you!

commented

f2588d6
fixed

Sorry, but the issue is not yet resolved. This is with ac-php 2.4.0 from melpa-stable, but also 20200916.751 had the same problem.

The problem seems to be the variable |-separated return types, I think this is called "union type" in php8.

If I remove all "union types" from that bootstrap80.php the error goes away.

bootstrap80.zip

[DEBUG]: 45% /var/www/localhost/htdocs/nextcloud-git/apps/cafevdb/vendor/symfony/polyfill-intl-normalizer/bootstrap80.php
[DEBUG]: PHP Fatal error:  Uncaught Error: Object of class PhpParser\Node\UnionType could not be converted to string in phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/PHPCtags.class.php:161
[DEBUG]: Stack trace:
[DEBUG]: #0 phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/PHPCtags.class.php(506): PHPCtags->func_get_return_type()
[DEBUG]: #1 phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/PHPCtags.class.php(269): PHPCtags->struct()
[DEBUG]: #2 phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/PHPCtags.class.php(470): PHPCtags->struct()
[DEBUG]: #3 phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/PHPCtags.class.php(269): PHPCtags->struct()
[DEBUG]: #4 phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/PHPCtags.class.php(626): PHPCtags->struct()
[DEBUG]: #5 phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/deal_config.php(237): PHPCtags->process_single_file()
[DEBUG]: #6 phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/deal_config.php(330): deal_file_tags()
[DEBUG]: #7 phar:/// in phar:///home/claus/.emacs.d/elpa/ac-php-core-20210129.951/phpctags/PHPCtags.class.php on line 161
[DEBUG]: 
ac-php: Something went wrong
ac-php: The re-indexing process exited abnormally
ac-php: Please re-check for incorrect syntax and possible PHP errors and try again later
[DEBUG]: exited abnormally with code 255
commented

@rotdrop re test

That was quick :)

The changed binary phpctags seems to fix it, at least there is no longer an error message and auto-completion still works after ac-php-remake-tags[-all].

Kind thanks! Could you elaborate shortly how you generate the phpctags binary? According to the some comments it is modified version of the original binary, wouldn't it be nice to track the necessary changes to the source code of phpctags somehow in the git repo?

Anyhow, kind thanks again, best

Claus