From 36143a6b6c4672ce7877bcce5102b99d67095c34 Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Wed, 27 Apr 2011 07:57:39 -0700 Subject: [PATCH] Fix for issue #307 --- lib/Twig/Extension/Core.php | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 9a34d6a..5429c07 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -495,5 +495,9 @@ function twig_test_defined($name, $context) function twig_test_empty($value) { - return null === $value || false === $value || '' === (string) $value; + if (null === $value || false === $value) { + return true; + } + + return empty($value) && '0' != $value; } -- 1.7.2.5