From 941d91813f01c1901d81b99829566aecb91bd376 Mon Sep 17 00:00:00 2001 From: Aveline Swan Date: Fri, 4 Jan 2013 18:45:24 +0800 Subject: [PATCH 1/2] Added PHP 5.4.x Support --- python_handlers.c | 2 +- python_object.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/python_handlers.c b/python_handlers.c index ec35eec..591e4e0 100644 --- a/python_handlers.c +++ b/python_handlers.c @@ -511,7 +511,7 @@ python_get_method(zval **object_ptr, char *method, int method_len TSRMLS_DC) f->scope = pip->ce; f->fn_flags = 0; f->prototype = NULL; - f->pass_rest_by_reference = 0; + /* f->pass_rest_by_reference = 0; */ f->num_args = python_get_arg_info(func, &(f->arg_info) TSRMLS_CC); Py_DECREF(func); diff --git a/python_object.c b/python_object.c index 8e11511..82b99db 100644 --- a/python_object.c +++ b/python_object.c @@ -104,9 +104,15 @@ python_object_create(zend_class_entry *ce TSRMLS_DC) pip->ce = ce; zend_object_std_init(&pip->base, ce TSRMLS_CC); - zend_hash_copy(pip->base.properties, &ce->default_properties, - (copy_ctor_func_t)zval_add_ref, - (void *) &tmp, sizeof(zval *)); + + #if PHP_VERSION_ID < 50399 + zend_hash_copy(pip->base.properties, &ce->default_properties, + (copy_ctor_func_t)zval_add_ref, + (void *) &tmp, sizeof(zval *)); + #else + object_properties_init(&(pip->base), ce); + #endif + /* Add this instance to the objects store using the Zend Objects API. */ retval.handle = zend_objects_store_put(pip, From 0c71cc7dc74db18cf2b52e227116df1fbd502607 Mon Sep 17 00:00:00 2001 From: Aveline Swan Date: Mon, 7 Jan 2013 10:27:53 +0800 Subject: [PATCH 2/2] Set pass_rest_by_reference when PHP_VERSION < 50400 --- python_handlers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python_handlers.c b/python_handlers.c index 591e4e0..e6fc21f 100644 --- a/python_handlers.c +++ b/python_handlers.c @@ -511,7 +511,9 @@ python_get_method(zval **object_ptr, char *method, int method_len TSRMLS_DC) f->scope = pip->ce; f->fn_flags = 0; f->prototype = NULL; - /* f->pass_rest_by_reference = 0; */ + #if PHP_VERSION_ID < 50400 + f->pass_rest_by_reference = 0; + #endif f->num_args = python_get_arg_info(func, &(f->arg_info) TSRMLS_CC); Py_DECREF(func);