From 163f80641d60dc1cc3f0bf2e5b7a33d033c2be50 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 29 Sep 2011 14:57:53 +0100 Subject: [PATCH] PHP 5.2 compatibility. --- twig.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/twig.c b/twig.c index 4c38658..690ce80 100644 --- a/twig.c +++ b/twig.c @@ -234,7 +234,11 @@ zval *TWIG_CALL_USER_FUNC_ARRAY(zval *object, char *function, zval *arguments) fci.function_table = EG(function_table); fci.function_name = zfunction; fci.symbol_table = NULL; +#if PHP_VERSIONID >= 50300 fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif fci.retval_ptr_ptr = &retval_ptr; fci.param_count = arg_count; fci.params = args; @@ -402,7 +406,11 @@ zval *TWIG_CALL_S(zval *object, char *method, char *arg0) fci.function_table = EG(function_table); fci.function_name = zfunction; fci.symbol_table = NULL; +#if PHP_VERSIONID >= 50300 fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif fci.retval_ptr_ptr = &retval_ptr; fci.param_count = 1; fci.params = args; @@ -450,7 +458,11 @@ int TWIG_CALL_Z(zval *object, char *method, zval *arg1) fci.function_table = EG(function_table); fci.function_name = zfunction; fci.symbol_table = NULL; +#if PHP_VERSIONID >= 50300 fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif fci.retval_ptr_ptr = &retval_ptr; fci.param_count = 1; fci.params = args; @@ -493,7 +505,11 @@ int TWIG_CALL_ZZ(zval *object, char *method, zval *arg1, zval *arg2) fci.function_table = EG(function_table); fci.function_name = zfunction; fci.symbol_table = NULL; +#if PHP_VERSIONID >= 50300 fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif fci.retval_ptr_ptr = &retval_ptr; fci.param_count = 2; fci.params = args; @@ -514,6 +530,11 @@ int TWIG_CALL_ZZ(zval *object, char *method, zval *arg1, zval *arg2) return success; } +#ifndef Z_SET_REFCOUNT_P +# define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc +# define Z_UNSET_ISREF_P(pz) pz->is_ref = 0 +#endif + void TWIG_NEW(zval *object, char *class, zval *value) { zend_class_entry **pce; -- 1.7.2.5