diff --git a/src/Compiler/AbstractCompiler.php b/src/Compiler/AbstractCompiler.php index ad9daff..337da23 100644 --- a/src/Compiler/AbstractCompiler.php +++ b/src/Compiler/AbstractCompiler.php @@ -130,7 +130,7 @@ protected function parseInlineFilters(string $echoBody): string } elseif ($arg[0] === '$') { $fmtArgs[] = $arg; } else { - $fmtArgs[] = Str::shellQuote($arg); + $fmtArgs[] = Str::paramQuotes($arg); } } diff --git a/test/Compiler/PregCompilerTest.php b/test/Compiler/PregCompilerTest.php index ce696e3..390aa04 100644 --- a/test/Compiler/PregCompilerTest.php +++ b/test/Compiler/PregCompilerTest.php @@ -129,7 +129,11 @@ public function testCompile_inline_echo_with_filters():void foreach ($tests as [$in, $out]) { $this->assertEquals($out, $p->compile($in)); } + } + public function testCompile_disableEchoFilter():void + { + $p = new PregCompiler(); $p->disableEchoFilter(); $tests = [ @@ -139,6 +143,10 @@ public function testCompile_inline_echo_with_filters():void '{{ $name ?: "inhere" | substr:0,3 }}', '' ], + [ + '{{ $name | append:, }}', + "" + ], ['{{ some_func() | raw }}', ''], ]; foreach ($tests as [$in, $out]) {