Skip to content

Commit

Permalink
Fix PHP 8.1 deprecation warning when user lambdas do not return a string
Browse files Browse the repository at this point in the history
Fixes #382
  • Loading branch information
bobthecow committed Dec 22, 2021
1 parent 4e2724d commit 26c8a44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Mustache/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ private function section%s(Mustache_Context $context, $indent, $value)
if (%s) {
$source = %s;
$result = call_user_func($value, $source, %s);
$result = (string) call_user_func($value, $source, %s);
if (strpos($result, \'{{\') === false) {
$buffer .= $result;
} else {
$buffer .= $this->mustache
->loadLambda((string) $result%s)
->loadLambda($result%s)
->renderInternal($context);
}
} elseif (!empty($value)) {
Expand Down

0 comments on commit 26c8a44

Please sign in to comment.