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
"regular expression is too large" when handling large arrays #10614
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
Oh my god, what in the hell is that code!? Doesn't look like a maintainable piece of code. My smartphone almost crashed trying to load the page. I'm inclined to say that this kind of bending and hacking is not supported 😊 |
Honestly I'm not sure if that example fits. I'm not sure who generates that long regex, probably some magic from the Laminas connector that tries to set all config keys it finds or something. It is not something part of our codebase. The issue is that PHPStan generates a baseline entry it can't parse. |
I tried to make the problem less worse: phpstan/phpstan-src@039a3dc Please try |
I'll reopen if you find out it still doesn't work. |
@ondrejmirtes Sorry, but cannot confirm the fix. Not sure if its a version mis-match (I am behind a packagist proxy), but even cloning phpstan-src and compiling the phar, I still saw the issue. Could create a reproduction repo for this: https://github.com/kingkero/phpstan-error-too-long/, info in README. Basically this (https://github.com/kingkero/phpstan-error-too-long/blob/main/module/Application/config/module.config.php#L8-L11) simulates the long config that we have in the prod setup. |
@kingkero Hi, I verified that the fix works. But you misunderstood the nature of the fix. You need to delete your current baseline that's commited here https://github.com/kingkero/phpstan-error-too-long/blob/main/phpstan.baseline.neon and generate it again with the newer PHPStan dev version. It's going to contain a shorter error message and the regex machine is not going to have a problem with that. You can install that version with |
You're right, I'm sorry for the extra noise. Can confirm it works as described. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
Currently introducing PHPStan to a larger Laminas project (already using slam/phpstan-laminas-framework), when generating the baseline one entry is:
I already shortened the line. The original line in the baseline is 60733 characters long.
Running
phpstan analyse
with that baseline results inThe line in code that triggers this error is:
This issue only happens when using the baseline. If I have an empty baseline, generate it new - it runs perfectly. But after generation trying to re-run I get the above posted issue.
I tried reproducing the issue in the playground, but the playground crashes. The code used can be found here (could not post it in the issue).
Code snippet that reproduces the problem
No response
Expected output
PHPStan doesn't crash parsing baselines it previously generated.
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: