#define Z_ADDREF_P(pz) (pz)->refcount++
#endif
+#if PHP_VERSION_ID >= 50300
+ #define APPLY_TSRMLS_DC TSRMLS_DC
+ #define APPLY_TSRMLS_CC TSRMLS_CC
+ #define APPLY_TSRMLS_FETCH()
+#else
+ #define APPLY_TSRMLS_DC
+ #define APPLY_TSRMLS_CC
+ #define APPLY_TSRMLS_FETCH() TSRMLS_FETCH()
+#endif
+
ZEND_BEGIN_ARG_INFO_EX(twig_template_get_attribute_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6)
ZEND_ARG_INFO(0, template)
ZEND_ARG_INFO(0, object)
TWIG_CALL_ZZ(object, "__construct", arg0, arg1 TSRMLS_CC);
}
-static int twig_add_array_key_to_string(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+static int twig_add_array_key_to_string(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
{
+ APPLY_TSRMLS_FETCH();
smart_str *buf;
char *joiner;
smart_str collector = { 0, 0, 0 };
smart_str_appendl(&collector, "", 0);
- zend_hash_apply_with_arguments(HASH_OF(array) TSRMLS_CC, twig_add_array_key_to_string, 2, &collector, joiner);
+ zend_hash_apply_with_arguments(HASH_OF(array) APPLY_TSRMLS_CC, twig_add_array_key_to_string, 2, &collector, joiner);
smart_str_0(&collector);
return collector.c;
return class_name;
}
-static int twig_add_method_to_class(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+static int twig_add_method_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
{
+ APPLY_TSRMLS_FETCH();
zval *retval;
char *item;
size_t item_len;
return 0;
}
-static int twig_add_property_to_class(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+static int twig_add_property_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
{
+ APPLY_TSRMLS_FETCH();
zend_class_entry *ce;
zval *retval;
char *class_name, *prop_name;
}
/* {{{ _adddynproperty */
-static int twig_add_dyn_property_to_class(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+static int twig_add_dyn_property_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
{
+ APPLY_TSRMLS_FETCH();
zend_class_entry *ce = *va_arg(args, zend_class_entry**);
zval *retval = va_arg(args, zval*), member;
char *class_name, *prop_name;
array_init(class_methods);
array_init(class_properties);
// add all methods to self::cache[$class]['methods']
- zend_hash_apply_with_arguments(&class_ce->function_table TSRMLS_CC, twig_add_method_to_class, 1, class_methods);
- zend_hash_apply_with_arguments(&class_ce->properties_info TSRMLS_CC, twig_add_property_to_class, 2, &class_ce, class_properties);
+ zend_hash_apply_with_arguments(&class_ce->function_table APPLY_TSRMLS_CC, twig_add_method_to_class, 1, class_methods);
+ zend_hash_apply_with_arguments(&class_ce->properties_info APPLY_TSRMLS_CC, twig_add_property_to_class, 2, &class_ce, class_properties);
if (object && Z_OBJ_HT_P(object)->get_properties) {
HashTable *properties = Z_OBJ_HT_P(object)->get_properties(object TSRMLS_CC);
- zend_hash_apply_with_arguments(properties TSRMLS_CC, twig_add_dyn_property_to_class, 2, &class_ce, class_properties);
+ zend_hash_apply_with_arguments(properties APPLY_TSRMLS_CC, twig_add_dyn_property_to_class, 2, &class_ce, class_properties);
}
add_assoc_zval(class_info, "methods", class_methods);
add_assoc_zval(class_info, "properties", class_properties);