case HTTP_MSG_PROPHASH_PARENT_MESSAGE:
case HTTP_MSG_CHILD_PROPHASH_PARENT_MESSAGE:
if (msg->parent) {
- RETVAL_OBJVAL(obj->parent);
+ RETVAL_OBJVAL(obj->parent, 1);
} else {
RETVAL_NULL();
}
}
}
if (ce) {
- ZVAL_OBJVAL(return_value, http_message_object_new_ex(ce, msg, NULL));
+ RETVAL_OBJVAL(http_message_object_new_ex(ce, msg, NULL), 0);
}
}
}
getObject(http_message_object, obj);
if (obj->message->parent) {
- RETVAL_OBJVAL(obj->parent);
+ RETVAL_OBJVAL(obj->parent, 1);
} else {
RETVAL_NULL();
}
zend_hash_copy(&msg->hdrs, &obj->message->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
phpstr_append(&msg->body, PHPSTR_VAL(obj->message), PHPSTR_LEN(obj->message));
- ZVAL_OBJVAL(return_value, http_message_object_new_ex(Z_OBJCE_P(getThis()), msg, NULL));
+ RETVAL_OBJVAL(http_message_object_new_ex(Z_OBJCE_P(getThis()), msg, NULL), 0);
}
/* }}} */
if (itr && itr->parent.handle) {
zval *old = obj->iterator;
MAKE_STD_ZVAL(obj->iterator);
- ZVAL_OBJVAL(obj->iterator, itr->parent);
- Z_OBJ_ADDREF_P(obj->iterator);
+ ZVAL_OBJVAL(obj->iterator, itr->parent, 1);
zval_ptr_dtor(&old);
} else {
zval_ptr_dtor(&obj->iterator);
zval_ptr_dtor(&resp);
MAKE_STD_ZVAL(message);
- ZVAL_OBJVAL(message, http_message_object_new_ex(http_message_object_ce, msg, NULL));
+ ZVAL_OBJVAL(message, http_message_object_new_ex(http_message_object_ce, msg, NULL), 0);
SET_PROP(responseMessage, message);
zval_ptr_dtor(&message);
SET_EH_THROW_HTTP();
message = GET_PROP(responseMessage);
if (Z_TYPE_P(message) == IS_OBJECT) {
- RETVAL_OBJECT(message);
+ RETVAL_OBJECT(message, 1);
} else {
RETVAL_NULL();
}
SET_EH_THROW_HTTP();
if ((msg = http_message_parse(PHPSTR_VAL(&obj->request->conv.request), PHPSTR_LEN(&obj->request->conv.request)))) {
- ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL));
+ RETVAL_OBJVAL(http_message_object_new_ex(http_message_object_ce, msg, NULL), 0);
}
SET_EH_NORMAL();
}
SET_EH_THROW_HTTP();
if ((msg = http_message_parse(PHPSTR_VAL(&obj->history), PHPSTR_LEN(&obj->history)))) {
- ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL));
+ RETVAL_OBJVAL(http_message_object_new_ex(http_message_object_ce, msg, NULL), 0);
}
SET_EH_NORMAL();
}
} else if (SUCCESS == http_request_object_requesthandler(obj, getThis())) {
http_request_exec(obj->request);
if (SUCCESS == http_request_object_responsehandler(obj, getThis())) {
- RETVAL_OBJECT(GET_PROP(responseMessage));
+ RETVAL_OBJECT(GET_PROP(responseMessage), 1);
}
}
current && obj->iterator.pos != pos++;
current = zend_llist_get_next_ex(&obj->pool.handles, &lpos));
if (current) {
- RETURN_OBJECT(*current);
+ RETURN_OBJECT(*current, 1);
}
}
RETURN_NULL();
#define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v))
#define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
/* return object(values) */
-#define RETVAL_OBJECT(o) \
- RETVAL_OBJVAL((o)->value.obj)
-#define RETURN_OBJECT(o) \
- RETVAL_OBJECT(o); \
+#define RETVAL_OBJECT(o, addref) \
+ RETVAL_OBJVAL((o)->value.obj, addref)
+#define RETURN_OBJECT(o, addref) \
+ RETVAL_OBJECT(o, addref); \
return
-#define RETVAL_OBJVAL(ov) \
- ZVAL_OBJVAL(return_value, ov) \
- if (Z_OBJ_HT_P(return_value)->add_ref) { \
- Z_OBJ_HT_P(return_value)->add_ref(return_value TSRMLS_CC); \
- }
-#define RETURN_OBJVAL(ov) \
- RETVAL_OBJVAL(ov); \
+#define RETVAL_OBJVAL(ov, addref) \
+ ZVAL_OBJVAL(return_value, ov, addref)
+#define RETURN_OBJVAL(ov, addref) \
+ RETVAL_OBJVAL(ov, addref); \
return
-#define ZVAL_OBJVAL(zv, ov) \
+#define ZVAL_OBJVAL(zv, ov, addref) \
(zv)->type = IS_OBJECT; \
- (zv)->value.obj = (ov);
+ (zv)->value.obj = (ov);\
+ if (addref && Z_OBJ_HT_P(zv)->add_ref) { \
+ Z_OBJ_HT_P(zv)->add_ref((zv) TSRMLS_CC); \
+ }
/* return property */
#define RETVAL_PROP(n) RETVAL_PROP_EX(getThis(), n)
#define RETURN_PROP(n) RETURN_PROP_EX(getThis(), n)