com php-src: Fixed reflection object destruction: ext/reflectio n/php_reflection.c
| From: | Dmitry Stogov | Date: | Tue, 25 Feb 2014 13:03:48 +0000 |
| Subject: | com php-src: Fixed reflection object destruction: ext/reflectio n/php_reflection.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77925@lists.php.net to get a copy of this message | ||
Commit: c077742b2a5c6d2a640ce64e76b0edc95ed5c74c
Author: Dmitry Stogov <dmitry@zend.com> Tue, 25 Feb 2014 17:03:48 +0400
Parents: 068ea84a840ca7273e6b6dc19d794bb0216aaab7
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c077742b2a5c6d2a640ce64e76b0edc95ed5c74c
Log:
Fixed reflection object destruction
Changed paths:
M ext/reflection/php_reflection.c
Diff:
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index e566711..5219053 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -204,6 +204,7 @@ typedef enum {
/* Struct for reflection objects */
typedef struct {
zend_object zo;
+ zval dummy; /* holder for the second property */
void *ptr;
reflection_type_t ref_type;
zval obj;
@@ -310,7 +311,7 @@ static void reflection_free_objects_storage(zend_object *object TSRMLS_DC) /* {{
}
intern->ptr = NULL;
zval_ptr_dtor(&intern->obj);
-//??? zend_objects_free_object_storage(object TSRMLS_CC);
+ zend_object_free(object TSRMLS_CC);
}
/* }}} */
@@ -1222,7 +1223,7 @@ static void reflection_parameter_factory(zend_function *fptr, zval
*closure_obje
zval name;
if (closure_object) {
- Z_ADDREF_P(closure_object);
+ if (Z_REFCOUNTED_P(closure_object)) Z_ADDREF_P(closure_object);
}
if (arg_info->name) {
ZVAL_STRINGL(&name, arg_info->name, arg_info->name_len);
@@ -1616,7 +1617,11 @@ ZEND_METHOD(reflection_function, __construct)
reflection_update_property(object, "name", &name);
intern->ptr = fptr;
intern->ref_type = REF_TYPE_FUNCTION;
- ZVAL_COPY_VALUE(&intern->obj, closure);
+ if (closure) {
+ ZVAL_COPY_VALUE(&intern->obj, closure);
+ } else {
+ ZVAL_UNDEF(&intern->obj);
+ }
intern->ce = NULL;
}
/* }}} */