Skip to content

Commit

Permalink
FilterExecutor::filterContent() converts HtmlStringable to text [Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 15, 2020
1 parent 5415b23 commit bf1ec51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Latte/Runtime/FilterExecutor.php
Expand Up @@ -116,6 +116,10 @@ public function filterContent(string $name, FilterInfo $info, ...$args)
}

[$callback, $aware] = $this->prepareFilter($lname);

if ($info->contentType === Engine::CONTENT_HTML && $args[0] instanceof HtmlStringable) {
$args[0] = $args[0]->__toString();
}
if ($aware) { // FilterInfo aware filter
array_unshift($args, $info);
return $callback(...$args);
Expand Down
5 changes: 5 additions & 0 deletions tests/Latte/CoreMacros.capture.phpt
Expand Up @@ -40,3 +40,8 @@ Assert::noError(function () use ($latte) { // uses keyword new
$latte->setSandboxMode();
$latte->renderToString('{capture $var}<html>{/capture}');
});

Assert::match( // bug #215
'',
$latte->renderToString('{capture $var|strip} <html> {/capture}')
);

0 comments on commit bf1ec51

Please sign in to comment.