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
Bug: long heredoc causes missing classes in classmap generation #10037
Comments
There definitely should be tests covering this in AutoloadGeneratorTest. I am quite surprised by this. As far as I can tell the regex above works fine https://regex101.com/r/TxfKNj/2 - do you have more details about the PCRE 2 error? |
@Seldaek I suspect it's a syntax error in the regex itself - in the code sample you have in regex101, you have fixed it already (removed the double Per the PHP manual:
A CI test run for just the |
@jrfnl the double |
@stof Thanks, I know, but that depends on the amount of |
Okay, so I've done some more test runs and it's a Will do some more digging. |
@jrfnl it would be great to identify the file for which this limit gets exhausted, to reproduce the issue. Also, can you try replacing the |
Bear with me.. trying some things out now and debugging... will get back with an update in a little while. |
Problem file is |
Lovely story in the heredoc 😂 |
yeah, having a huge heredoc was what I expected. And this is a heredoc with lots of empty lines, for which my suggested change from above might help (as it reduces the way they can be matched) |
Testing with the first ~200 lines of the text from the problem file in regex101, I've so far managed to bring the number of steps needed to get to a match down from 37.761 to 45 .... getting somewhere... now off to run the tests with the adjusted regex to see if everything still passes.... |
Tested with phpDocumentor: ✅ deprecation notice is gone Adding a test for this now to the testsuite. |
Well that was fun... while creating the tests for my changes, I discovered a second bug in the regex.... which my fix (not completely) accidentally fixes as well 😂 |
I've opened PR #10050 which adds tests for both issues separately + applies a fix. |
The following deprecation notice shows during the generation of an optimized classmap on PHP 8.1:
Steps to reproduce:
composer install --no-progress --prefer-dist --optimize-autoloader
while on PHP 8.1(beta1)The error can be seen in the "Install Composer dependencies & cache dependencies" step in this CI transcript: https://github.com/jrfnl/phpDocumentor/runs/3241452949?check_suite_focus=true
This is caused by a bug in the regex for which I have a fix lined up. I'm still trying to verify, however, whether there is an existing test which already covers this or not.
This bug has probably been around since PHP 7.3 when PHP switched to PCRE 2.0, which contains stricter regex validation (
preg_replace()
returnsnull
when there is an error in the regex).The text was updated successfully, but these errors were encountered: