xcwen / ac-php

emacs auto-complete & company-mode for php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP Fatal error: Uncaught Error: Object of class PhpParser\Node\NullableType could not be converted to string

flaviovs opened this issue · comments

I'm getting this from latest ac-php-core 20240305.600 phpctags:

PHP Fatal error:  Uncaught Error: Object of class PhpParser\Node\NullableType could not be converted to string in phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/PHPCtags.class.php:459
Stack trace:
#0 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/PHPCtags.class.php(288): PHPCtags->struct(Object(PhpParser\Node\Stmt\Property))
#1 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/PHPCtags.class.php(449): PHPCtags->struct(Array, false, Array)
#2 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/PHPCtags.class.php(288): PHPCtags->struct(Object(PhpParser\Node\Stmt\Trait_))
#3 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/PHPCtags.class.php(617): PHPCtags->struct(Array, false, Array)
#4 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/PHPCtags.class.php(288): PHPCtags->struct(Object(PhpParser\Node\Stmt\Namespace_))
#5 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/PHPCtags.class.php(709): PHPCtags->struct(Array, true)
#6 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/deal_config.php(270): PHPCtags->process_single_file('/home/flaviovs/...')
#7 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/deal_config.php(386): deal_file_tags(true, '/home/flaviovs/...', false, false, '/home/flaviovs/...', '/home/flaviovs/...', true, Array, Array, Array, 0, 50, Object(Ruleset))
#8 phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/bootstrap.php(256): deal_config('/home/flaviovs/...', false, true, '/home/flaviovs/...', false)
#9 /home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags(10): include('phar:///home/fl...')
#10 {main}
  thrown in phar:///home/flaviovs/.emacs.d/elpa/ac-php-core-20240305.600/phpctags/PHPCtags.class.php on line 459

Crash happens when building the file list.

Since it mentions "Property" I suspect it may be related to #158, but I'm not sure. I'm running phpctags on a large codebase, with many vendor packages, and it is possible that there's a broken @property-{write,read} somewhere that uncovered a bug. Nevertheless ideally the script should handle it gracefully, not crash.

Let me know if you need any more info or help to fix this.

UPDATE: rebuilt phpctags without the changes in #158 and it did not crash, so not a regression.

Reverted to xcwen/phpctags@f7eac04 and got no crash, so it must be some of the others changes in xcwen/phpctags@fa78c60.

commented

1

commented

fixed