Skip to content
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

[9.x] Fix infinite loop in blade compiler #45780

Merged
merged 2 commits into from
Jan 24, 2023

Conversation

imanghafoori1
Copy link
Contributor

@imanghafoori1 imanghafoori1 commented Jan 24, 2023

During the latest bug fix in the blade compiler, I found that if the user passes invalid PHP syntax to blade tag calls, it will end up in an infinite loop that eventually fills up the memory and crashes.
php artisan view:cache

Str::after return the whole input if it can not find the $needle so we check if it is equal and break.
If you comment out the line: break; the added test will result in an infinite loop.

This is what the end user see in case of syntax error in the browser (after this fix):
image

@taylorotwell taylorotwell merged commit 519831d into laravel:9.x Jan 24, 2023
@imanghafoori1 imanghafoori1 deleted the fix_blade_inf_loop branch January 24, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants