From 7dd0ca59cf27b2a13b408eca1e89962e7de8cd06 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 18 Feb 2021 15:22:53 +0100 Subject: [PATCH] {block|filter} passes full content-type to FilterInfo --- src/Latte/Macros/BlockMacros.php | 2 +- tests/Latte/contentType.compatibility.phpt | 5 ++++- tests/Latte/contentType.html.javascript.phpt | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Latte/Macros/BlockMacros.php b/src/Latte/Macros/BlockMacros.php index bb860e2e7..1270baf83 100644 --- a/src/Latte/Macros/BlockMacros.php +++ b/src/Latte/Macros/BlockMacros.php @@ -263,7 +263,7 @@ public function macroBlock(MacroNode $node, PhpWriter $writer): string $node->modifiers .= '|escape'; $node->closingCode = $writer->write( '', - $node->context[0] + implode($node->context) ); return 'ob_start(function () {});'; } diff --git a/tests/Latte/contentType.compatibility.phpt b/tests/Latte/contentType.compatibility.phpt index df771e82c..2488715b4 100644 --- a/tests/Latte/contentType.compatibility.phpt +++ b/tests/Latte/contentType.compatibility.phpt @@ -379,4 +379,7 @@ Assert::same('

" <

', $latte->renderToString('context1c')); Assert::same('

', $latte->renderToString('context2')); Assert::same('

', $latte->renderToString('context2a')); Assert::same('', $latte->renderToString('context6')); -Assert::same('', $latte->renderToString('context6a')); + +Assert::error(function () use ($latte) { + $latte->renderToString('context6a'); +}, E_USER_WARNING, 'Filter |stripHtml used with incompatible type HTMLCOMMENT'); diff --git a/tests/Latte/contentType.html.javascript.phpt b/tests/Latte/contentType.html.javascript.phpt index 669d6b85a..5d111c6e0 100644 --- a/tests/Latte/contentType.html.javascript.phpt +++ b/tests/Latte/contentType.html.javascript.phpt @@ -115,3 +115,9 @@ Assert::match(
{$i}
') ); + +// trim inside ', + $latte->renderToString('') +);