I have run into this issue as well. Applying your changes worked for me and the Exception is not thrown any more.
I am not sure if the following commit is needed any more:
https://git.drupalcode.org/project/image_field_caption/-/merge_requests/5/diffs?commit_id=69107bba3373b33b7e0d71312f9772133016c5cf
since the implementation changed in Version 2.0.x
Should this patch be rewritten for 2.0.x or is the implementation not needed any more?
batigolix → credited pjovanovic → .
So after a long debugging session, I found the problem.
The fix: update to the newest version, for me, it was v4.18.0
The Problem: For some reason the version used is not the newest and the older version probably has a problem with php8.
I found that the token processed in the Lexer.php file vendor/nikic/php-parser/lib/PhpParser/Lexer.php
sometimes contains an "&" sign, which causes the parsing to fail. When I updated, the following if statement was added to address this problem:
if ($token === '&')
at Line 212. This should solve your issue and let you scan your modules.
The package link: https://packagist.org/packages/nikic/php-parser#v4.18.0
pjo-previon → created an issue.
I tested the patch on Drupal 9.5.8 with PHP 8.1, and it worked for me, the error on screen has vanished now, however I needed another patch to get rid of another error, issue: https://www.drupal.org/project/gtranslate/issues/3350875 🐛 Warning: foreach() argument must be of type array|object GTranslateBlock.php RTBC after I applied the patch from the issue in the link, I still had the error described in this issue, which was fixed by this patch. So in summary, it's safe to say that this patch does fix the problem.
Thank you very much!
Thank you very much for the fast response, it may take a while until I see the role, right?
pjo-previon → created an issue.
I took the patch #69 and aligned the method signature of the FloodUnblockManager::fetchIdentifiers with the interface method.