From: Eugene Leonovich Date: Wed, 16 Jan 2013 08:40:49 +0000 (+0100) Subject: Tweak twig_constant() X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=a1b7ec56e6dfc94977e9000ab1567beee8ab3239;p=web%2Fkonrad%2Ftwig.git Tweak twig_constant() --- diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 2110120..c1a37d8 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -1267,10 +1267,9 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a */ function twig_constant($constant, $object = null) { - if (!$object) { - return constant($constant); + if ($object) { + $constant = get_class($object).'::'.$constant; } - $class = get_class($object); - return constant($class.'::'.$constant); + return constant($constant); }