From 86214c460186e23c273979bdc2787474eff039e4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 Nov 2011 19:36:25 +0100 Subject: [PATCH] fixed a crash under certain versions of PHP when an object with a __toString() method is used with htmlspecialchars --- lib/Twig/Extension/Core.php | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 40cf292..f98ce5a 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -498,6 +498,8 @@ function twig_escape_filter(Twig_Environment $env, $string, $type = 'html', $cha $charset = $env->getCharset(); } + $string = (string) $string; + switch ($type) { case 'js': // escape all non-alphanumeric characters -- 1.7.2.5