Skip to content

Commit 54d9c8b

Browse files
[12.x] Fix: Handle ParseError in hasEvenNumberOfParentheses when Xdebug is active (#58128)
* [12.x] Fix: Handle `ParseError` in `hasEvenNumberOfParentheses` when Xdebug is active fix #57472 Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> --------- Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> Co-authored-by: Aditya Anurag <adityaanurag2003@gmail.com>
1 parent 16ef628 commit 54d9c8b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Illuminate/View/Compilers/BladeCompiler.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Support\Traits\ReflectsClosures;
1414
use Illuminate\View\Component;
1515
use InvalidArgumentException;
16+
use ParseError;
1617

1718
class BladeCompiler extends Compiler implements CompilerInterface
1819
{
@@ -620,7 +621,11 @@ protected function replaceFirstStatement($search, $replace, $subject, $offset)
620621
*/
621622
protected function hasEvenNumberOfParentheses(string $expression)
622623
{
623-
$tokens = token_get_all('<?php '.$expression);
624+
try {
625+
$tokens = token_get_all('<?php '.$expression);
626+
} catch (ParseError) {
627+
return false;
628+
}
624629

625630
if (Arr::last($tokens) !== ')') {
626631
return false;

0 commit comments

Comments
 (0)