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);
}
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);