Skip to content

Conversation

@adityaanurag0219
Copy link

Summary

When Xdebug is enabled, token_get_all() may throw a ParseError for incomplete or malformed Blade expressions.
This causes tests or runtime Blade compilation to crash with:

ParseError: Unclosed '(' in BladeCompiler.php:623

Fix

Added a try/catch (\ParseError) block around token_get_all() in
Illuminate\View\Compilers\BladeCompiler::hasEvenNumberOfParentheses.

If a parse error occurs, the method now gracefully returns false instead of crashing.

Impact

Prevents test suite and runtime crashes under Xdebug
Keeps behavior identical for valid expressions
No breaking changes, PSR-12 and Pint-compliant

Related issue

Fixes #57472

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.

Xdebug throws “ParseError: Unclosed '('” after marking test as incomplete when running PHPUnit inside Laravel Sail

1 participant