From dc48f11d9772b645975da18bcaeb7efad4280626 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 23 Mar 2023 13:18:20 +0300 Subject: [PATCH] Fixing Warn(..) function so that it doesn't output into resulting code --- src/bind.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bind.inc.php b/src/bind.inc.php index ae6ae9e..87f66fe 100644 --- a/src/bind.inc.php +++ b/src/bind.inc.php @@ -158,7 +158,11 @@ function add_twig_support(\Twig\Environment $twig) $twig->addFunction(new \Twig\TwigFunction('Warn', function($e) { - echo "WARN: $e\n"; + //NOTE: we can't just echo the value because it will + // be rendered into resulting code + register_shutdown_function(function() use($e) { + echo "WARN: $e\n"; + }); } )); $twig->addFunction(new \Twig\TwigFunction('has_token',