Skip to content

Commit

Permalink
Merge pull request #16607 from laravel/revert-16506-5.3
Browse files Browse the repository at this point in the history
Revert "[5.3] Fix View compilation bug"
  • Loading branch information
taylorotwell authored Nov 30, 2016
2 parents 2f19ec5 + 4808b0b commit 7e898dd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/View/Compilers/BladeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ protected function compileEscapedEchos($value)
*/
public function compileEchoDefaults($value)
{
return preg_replace('/^(?=\$)([^\'"]+?)(?:\s+or\s+)(.+?)$/s', 'isset($1) ? $1 : $2', $value);
return preg_replace('/^(?=\$)(.+?)(?:\s+or\s+)(.+?)$/s', 'isset($1) ? $1 : $2', $value);
}

/**
Expand Down
42 changes: 0 additions & 42 deletions tests/View/ViewBladeCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,48 +98,6 @@ public function testEchosAreCompiled()
$this->assertEquals("<?php echo e(\$name); ?>\n\n", $compiler->compileString("{{ \$name }}\n"));
$this->assertEquals("<?php echo e(\$name); ?>\r\n\r\n", $compiler->compileString("{{ \$name }}\r\n"));

$this->assertEquals('<?php echo e($name["key"]); ?>', $compiler->compileString('{{{$name["key"]}}}'));
$this->assertEquals('<?php echo e($name["key"]); ?>', $compiler->compileString('{{$name["key"]}}'));
$this->assertEquals('<?php echo e($name["key"]); ?>', $compiler->compileString('{{ $name["key"] }}'));
$this->assertEquals('<?php echo e($name["key"]); ?>', $compiler->compileString('{{
$name["key"]
}}'));

$this->assertEquals('<?php echo e($name["key with space"]); ?>', $compiler->compileString('{{{$name["key with space"]}}}'));
$this->assertEquals('<?php echo e($name["key with space"]); ?>', $compiler->compileString('{{$name["key with space"]}}'));
$this->assertEquals('<?php echo e($name["key with space"]); ?>', $compiler->compileString('{{ $name["key with space"] }}'));
$this->assertEquals('<?php echo e($name["key with space"]); ?>', $compiler->compileString('{{
$name["key with space"]
}}'));

$this->assertEquals('<?php echo e($name[\'key\']); ?>', $compiler->compileString('{{{$name[\'key\']}}}'));
$this->assertEquals('<?php echo e($name[\'key\']); ?>', $compiler->compileString('{{$name[\'key\']}}'));
$this->assertEquals('<?php echo e($name[\'key\']); ?>', $compiler->compileString('{{ $name[\'key\'] }}'));
$this->assertEquals('<?php echo e($name[\'key\']); ?>', $compiler->compileString('{{
$name[\'key\']
}}'));

$this->assertEquals('<?php echo e($name[\'key with space\']); ?>', $compiler->compileString('{{{$name[\'key with space\']}}}'));
$this->assertEquals('<?php echo e($name[\'key with space\']); ?>', $compiler->compileString('{{$name[\'key with space\']}}'));
$this->assertEquals('<?php echo e($name[\'key with space\']); ?>', $compiler->compileString('{{ $name[\'key with space\'] }}'));
$this->assertEquals('<?php echo e($name[\'key with space\']); ?>', $compiler->compileString('{{
$name[\'key with space\']
}}'));

$this->assertEquals('<?php echo e($name[\'key or space\']); ?>', $compiler->compileString('{{{$name[\'key or space\']}}}'));
$this->assertEquals('<?php echo e($name[\'key or space\']); ?>', $compiler->compileString('{{$name[\'key or space\']}}'));
$this->assertEquals('<?php echo e($name[\'key or space\']); ?>', $compiler->compileString('{{ $name[\'key or space\'] }}'));
$this->assertEquals('<?php echo e($name[\'key or space\']); ?>', $compiler->compileString('{{
$name[\'key or space\']
}}'));

$this->assertEquals('<?php echo e($name["key or space"]); ?>', $compiler->compileString('{{{$name["key or space"]}}}'));
$this->assertEquals('<?php echo e($name["key or space"]); ?>', $compiler->compileString('{{$name["key or space"]}}'));
$this->assertEquals('<?php echo e($name["key or space"]); ?>', $compiler->compileString('{{ $name["key or space"] }}'));
$this->assertEquals('<?php echo e($name["key or space"]); ?>', $compiler->compileString('{{
$name["key or space"]
}}'));

$this->assertEquals('<?php echo e(isset($name) ? $name : "foo"); ?>', $compiler->compileString('{{ $name or "foo" }}'));
$this->assertEquals('<?php echo e(isset($user->name) ? $user->name : "foo"); ?>', $compiler->compileString('{{ $user->name or "foo" }}'));
$this->assertEquals('<?php echo e(isset($name) ? $name : "foo"); ?>', $compiler->compileString('{{$name or "foo"}}'));
Expand Down

0 comments on commit 7e898dd

Please sign in to comment.