From d3c0a369057d0b6ebf29b5f51c903b1a85e3e09b Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 2 Sep 2018 13:28:46 +0200 Subject: [PATCH] escape lang directive echos --- .../View/Compilers/Concerns/CompilesTranslations.php | 6 +++--- tests/View/Blade/BladeExpressionTest.php | 4 ++-- tests/View/Blade/BladeLangTest.php | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php b/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php index feb7e6510c6b..bdc071a65a01 100644 --- a/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php +++ b/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php @@ -18,7 +18,7 @@ protected function compileLang($expression) return "startTranslation{$expression}; ?>"; } - return "getFromJson{$expression}; ?>"; + return "getFromJson{$expression}); ?>"; } /** @@ -28,7 +28,7 @@ protected function compileLang($expression) */ protected function compileEndlang() { - return 'renderTranslation(); ?>'; + return 'renderTranslation()); ?>'; } /** @@ -39,6 +39,6 @@ protected function compileEndlang() */ protected function compileChoice($expression) { - return "choice{$expression}; ?>"; + return "choice{$expression}); ?>"; } } diff --git a/tests/View/Blade/BladeExpressionTest.php b/tests/View/Blade/BladeExpressionTest.php index 930b48e51ae9..c25891ddbe56 100644 --- a/tests/View/Blade/BladeExpressionTest.php +++ b/tests/View/Blade/BladeExpressionTest.php @@ -6,13 +6,13 @@ class BladeExpressionTest extends AbstractBladeTestCase { public function testExpressionsOnTheSameLine() { - $this->assertEquals('getFromJson(foo(bar(baz(qux(breeze()))))); ?> space () getFromJson(foo(bar)); ?>', $this->compiler->compileString('@lang(foo(bar(baz(qux(breeze()))))) space () @lang(foo(bar))')); + $this->assertEquals('getFromJson(foo(bar(baz(qux(breeze())))))); ?> space () getFromJson(foo(bar))); ?>', $this->compiler->compileString('@lang(foo(bar(baz(qux(breeze()))))) space () @lang(foo(bar))')); } public function testExpressionWithinHTML() { $this->assertEquals('>', $this->compiler->compileString('')); $this->assertEquals('>', $this->compiler->compileString('')); - $this->assertEquals(' getFromJson(\'foo\'); ?>>', $this->compiler->compileString('')); + $this->assertEquals(' getFromJson(\'foo\')); ?>>', $this->compiler->compileString('')); } } diff --git a/tests/View/Blade/BladeLangTest.php b/tests/View/Blade/BladeLangTest.php index 6f32cac6543d..c5232614cc6a 100644 --- a/tests/View/Blade/BladeLangTest.php +++ b/tests/View/Blade/BladeLangTest.php @@ -7,13 +7,13 @@ class BladeLangTest extends AbstractBladeTestCase public function testStatementThatContainsNonConsecutiveParenthesisAreCompiled() { $string = "Foo @lang(function_call('foo(blah)')) bar"; - $expected = "Foo getFromJson(function_call('foo(blah)')); ?> bar"; + $expected = "Foo getFromJson(function_call('foo(blah)'))); ?> bar"; $this->assertEquals($expected, $this->compiler->compileString($string)); } public function testLanguageAndChoicesAreCompiled() { - $this->assertEquals('getFromJson(\'foo\'); ?>', $this->compiler->compileString("@lang('foo')")); - $this->assertEquals('choice(\'foo\', 1); ?>', $this->compiler->compileString("@choice('foo', 1)")); + $this->assertEquals('getFromJson(\'foo\')); ?>', $this->compiler->compileString("@lang('foo')")); + $this->assertEquals('choice(\'foo\', 1)); ?>', $this->compiler->compileString("@choice('foo', 1)")); } }