zend_throw_exception_ex(*pce, 0 TSRMLS_CC, buffer);
}
+char *TWIG_GET_CLASS_NAME(zval *object)
+{
+ char *class_name;
+ zend_uint class_name_len;
+
+ if (Z_TYPE_P(object) != IS_OBJECT) {
+ return "";
+ }
+ zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
+ return class_name;
+}
+
static void twig_add_method_to_class(zend_function *mptr TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
{
zval *retval = va_arg(args, zval*);
}
*/
if (Z_TYPE_P(object) == IS_OBJECT) {
- TWIG_THROW_EXCEPTION("Twig_Error_Runtime", "Key \"%s\" in object (with ArrayAccess) of type \"%s\" does not exist", Z_STRVAL_P(item), TWIG_GET_CLASS(object));
+ TWIG_THROW_EXCEPTION("Twig_Error_Runtime", "Key \"%s\" in object (with ArrayAccess) of type \"%s\" does not exist", Z_STRVAL_P(item), TWIG_GET_CLASS_NAME(object));
} else {
TWIG_THROW_EXCEPTION("Twig_Error_Runtime", "Key \"%s\" for array with keys \"%s\" does not exist", Z_STRVAL_P(item), TWIG_IMPLODE_ARRAY_KEYS(", ", object));
}
}
}
*/
- char *class_name;
- zend_uint class_name_len;
+ char *class_name = TWIG_GET_CLASS_NAME(object);
zval *tmp_self_cache;
- zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
tmp_self_cache = TWIG_GET_STATIC_PROPERTY(template, "cache");
if (!TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name)) {