fix leaks; all tests pass
[m6w6/ext-http] / php_http_message.c
index 4f21a838fec3d03ef0107d56f042c74051ab198b..a885cb58a69cfb87212855760755d5dac019575c 100644 (file)
@@ -496,7 +496,6 @@ void php_http_message_free(php_http_message_t **message)
 
 static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *rv);
 static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
-static HashTable *php_http_message_object_get_props(zval *object);
 
 static zend_object_handlers php_http_message_object_handlers;
 static HashTable php_http_message_object_prophandlers;
@@ -690,7 +689,8 @@ void php_http_message_object_reverse(zval *zmsg, zval *return_value)
 
                /* add ref, because we previously have not been a parent message */
                Z_ADDREF_P(zmsg);
-               RETVAL_OBJECT(&objects[last]->zo, 1);
+               /* no addref, because we've been a parent message previously */
+               RETVAL_OBJECT(&objects[last]->zo, 0);
 
                efree(objects);
        } else {
@@ -872,7 +872,14 @@ static zval *php_http_message_object_read_prop(zval *object, zval *member, int t
                        ZVAL_COPY_VALUE(return_value, tmp);
                }
        } else {
-               return_value = php_property_proxy_zval(object, member_name);
+               php_property_proxy_t *proxy;
+               php_property_proxy_object_t *proxy_obj;
+
+               proxy = php_property_proxy_init(object, member_name);
+               proxy_obj = php_property_proxy_object_new_ex(NULL, proxy);
+
+               ZVAL_OBJ(tmp, &proxy_obj->zo);
+               return tmp;
        }
 
        zend_string_release(member_name);
@@ -897,7 +904,7 @@ static void php_http_message_object_write_prop(zval *object, zval *member, zval
        zend_string_release(member_name);
 }
 
-static HashTable *php_http_message_object_get_props(zval *object)
+static HashTable *php_http_message_object_get_debug_info(zval *object, int *is_temp)
 {
        zval tmp;
        php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
@@ -906,6 +913,7 @@ static HashTable *php_http_message_object_get_props(zval *object)
        size_t ver_len, url_len = 0;
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
+       *is_temp = 0;
        
 #define UPDATE_PROP(name_str, action_with_tmp) \
        do { \
@@ -1971,7 +1979,7 @@ PHP_MINIT_FUNCTION(http_message)
        php_http_message_object_handlers.free_obj = php_http_message_object_free;
        php_http_message_object_handlers.read_property = php_http_message_object_read_prop;
        php_http_message_object_handlers.write_property = php_http_message_object_write_prop;
-       php_http_message_object_handlers.get_properties = php_http_message_object_get_props;
+       php_http_message_object_handlers.get_debug_info = php_http_message_object_get_debug_info;
        php_http_message_object_handlers.get_property_ptr_ptr = NULL;
 
        zend_class_implements(php_http_message_class_entry, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);