Skip to content

Commit c91a52f

Browse files
authored
Revert "fix single line @php statements to not be parsed as php blocks when @endphp is also in the same file, + unit test, fixes #45330 (#45333)" (#45389)
This reverts commit 2427cec.
1 parent 8da1bc9 commit c91a52f

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

src/Illuminate/View/Compilers/BladeCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ protected function storeVerbatimBlocks($value)
387387
*/
388388
protected function storePhpBlocks($value)
389389
{
390-
return preg_replace_callback('/(?<!@)@php(?! ?\()(.*?)@endphp/s', function ($matches) {
390+
return preg_replace_callback('/(?<!@)@php(.*?)@endphp/s', function ($matches) {
391391
return $this->storeRawBlock("<?php{$matches[1]}?>");
392392
}, $value);
393393
}

tests/View/Blade/BladePhpStatementsTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,4 @@ public function testStringWithEscapingDataValue()
8484

8585
$this->assertEquals($expected, $this->compiler->compileString($string));
8686
}
87-
88-
public function testCompilationOfMixedPhpStatements()
89-
{
90-
$string = '@php($set = true) @php ($hello = \'hi\') @php echo "Hello world" @endphp';
91-
$expected = '<?php ($set = true); ?> <?php ($hello = \'hi\'); ?> <?php echo "Hello world" ?>';
92-
$this->assertEquals($expected, $this->compiler->compileString($string));
93-
}
9487
}

0 commit comments

Comments
 (0)