Security update for Core, with self-updated composer
[yaffs-website] / vendor / twig / twig / ext / twig / twig.c
index 6173c006728e5fa7cb9852f76ef455dcc074779f..b81d8ce3c33764a86f1fb21cecc2894756d9ce7f 100644 (file)
@@ -870,6 +870,8 @@ PHP_FUNCTION(twig_template_get_attributes)
 
                if (null === $object) {
                        $message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item);
+               } elseif (is_array($object)) {
+                       $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item);
                } else {
                        $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object);
                }
@@ -885,9 +887,9 @@ PHP_FUNCTION(twig_template_get_attributes)
                type_name = zend_zval_type_name(object);
                Z_ADDREF_P(object);
                if (Z_TYPE_P(object) == IS_NULL) {
-                       convert_to_string_ex(&object);
-
-                       TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable.", item, type_name);
+                       TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a null variable.", item);
+               } else if (Z_TYPE_P(object) == IS_ARRAY) {
+                       TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on an array.", item);
                } else {
                        convert_to_string_ex(&object);