From c01b22de1d6070dcd589cf203de4f002e90eff55 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 22 Jan 2015 14:12:40 +0100 Subject: [PATCH] fix message object reversion --- php_http_message.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/php_http_message.c b/php_http_message.c index 4109202..caf9ee8 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -688,7 +688,7 @@ 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_OBJ(&objects[last]->zo); + RETVAL_OBJECT(&objects[last]->zo, 1); efree(objects); } else { @@ -806,6 +806,8 @@ php_http_message_object_t *php_http_message_object_new_ex(zend_class_entry *ce, o->message = msg; if (msg->parent) { o->parent = php_http_message_object_new_ex(ce, msg->parent); + /* not assigned to any zval, so refcount is 0 */ + --GC_REFCOUNT(&o->parent->zo); } o->body = php_http_message_body_object_new_ex(php_http_message_body_class_entry, php_http_message_body_init(&msg->body, NULL)); } -- 2.30.2