From 26c8a448fcac3c9094a3a20604f8a073838bf872 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 21 Dec 2021 23:11:27 -0500 Subject: [PATCH] Fix PHP 8.1 deprecation warning when user lambdas do not return a string Fixes #382 --- src/Mustache/Compiler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index 610369ed..60ad59c6 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -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)) {