Skip to content

Commit

Permalink
Revert "fix single line @php statements to not be parsed as php block…
Browse files Browse the repository at this point in the history
…s when @endphp is also in the same file, + unit test, fixes #45330 (#45333)" (#45389)

This reverts commit 2427cec.
  • Loading branch information
taylorotwell committed Dec 21, 2022
1 parent 8da1bc9 commit c91a52f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/View/Compilers/BladeCompiler.php
Expand Up @@ -387,7 +387,7 @@ protected function storeVerbatimBlocks($value)
*/
protected function storePhpBlocks($value)
{
return preg_replace_callback('/(?<!@)@php(?! ?\()(.*?)@endphp/s', function ($matches) {
return preg_replace_callback('/(?<!@)@php(.*?)@endphp/s', function ($matches) {
return $this->storeRawBlock("<?php{$matches[1]}?>");
}, $value);
}
Expand Down
7 changes: 0 additions & 7 deletions tests/View/Blade/BladePhpStatementsTest.php
Expand Up @@ -84,11 +84,4 @@ public function testStringWithEscapingDataValue()

$this->assertEquals($expected, $this->compiler->compileString($string));
}

public function testCompilationOfMixedPhpStatements()
{
$string = '@php($set = true) @php ($hello = \'hi\') @php echo "Hello world" @endphp';
$expected = '<?php ($set = true); ?> <?php ($hello = \'hi\'); ?> <?php echo "Hello world" ?>';
$this->assertEquals($expected, $this->compiler->compileString($string));
}
}

0 comments on commit c91a52f

Please sign in to comment.