diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 2110120ff..c1a37d8fd 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); }