-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Uncaught TypeError: Argument 1 passed to PhpParser\NodeTraverser::traverseNode() must implement interface PhpParser\Node, string given #687
Comments
Same at laravel/laravel.com#124 |
Please provide a minimal reproduction. |
@nikic I would like some help because for now I struggle reproducing this issue on any of my workstations and versions of PHP, with docker or not Could you please help me ? The php version does not seem to have something to do with this issue, TravisCI has the error. Using docker on the same Ubuntu version I could not reproduce it. Here is another trace: https://user-images.githubusercontent.com/463230/87959570-ba609700-ca78-11ea-980a-481af7988ce6.png |
@williamdes Based on the trace, the best guess I have is that you have an |
Maybe PHP-Parser/lib/PhpParser/NodeTraverser.php Line 275 in acaf3fe
|
No, that's not it, returning a string from enterNode() would already throw. I don't really see how this can happen, as we check that Maybe this is a PHP bug? |
Do you have some instructions on how to run Doctum on an affected codebase (even if it does not reproduce for you)? |
Yes, basically you can do is:
install: curl -O https://doctum.long-term.support/releases/latest/doctum.phar
script:
- chmod +x ./doctum.phar
- php ./doctum.phar --version
- php ./doctum.phar --no-interaction update ./test/doctum-config.php
My PR should show you how to setup Doctum (phpmyadmin/phpmyadmin#16273) I hope you will be able to reproduce this issue, anyway thanks a lot for the above comments. Let me know if you expect me to do something :) |
I've managed to track this down to this genius piece of code: https://github.com/phpDocumentor/ReflectionDocBlock/blob/1ac416df3f66c542f2d3688925105b539f064b64/src/DocBlock/Tags/InvalidTag.php#L78 NodeTraverser iterates over the array by-reference, the reference gets captured by the exception trace and that code ends up converting the node into a string :( This needs to be fixed in phpDocumentor/ReflectionDocBlock, and I will also fix https://bugs.php.net/bug.php?id=79108 for PHP 8.0, to ensure this kind of interference is impossible in the future. |
I've fixed the issue on the PHP side for PHP 8, and reported phpDocumentor/ReflectionDocBlock#249 for ReflectionDocBlock. Closing here as the rest is outside the scope of PhpParser. |
Thank you so much!! |
Using Doctum I have this issue, I tried to switch to PHP 7.4 just in case but it does not solve the issue.
Doctum 5.0.1 uses
"nikic/php-parser": "~4.5",
https://travis-ci.org/github/phpmyadmin/phpmyadmin/jobs/709689913#L350
The text was updated successfully, but these errors were encountered: