From 8fb35d5fd44144cadb4192007ce8ae77704b72e1 Mon Sep 17 00:00:00 2001 From: Cyril PERROT Date: Mon, 21 Nov 2016 14:45:14 +0100 Subject: [PATCH] Fix unconsistent behavior with "get" and "is" --- lib/Twig/Template.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index aa5e5b3b7c..54f6b0dcd7 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -604,6 +604,9 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ } else { $methods = get_class_methods($object); } + // sort values to have consistent behavior, so that "get" methods win precedence over "is" methods + sort($methods); + $cache = array(); foreach ($methods as $method) {