X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_message_object.c;h=7069e6aa50f3c058e1f3623938062ddd5eefafb7;hb=f43d1c3e5b33a747150a521755cd97ef6e69db0c;hp=3d2e72714ba5e818b1426691c9fa984af69194e3;hpb=fc720d489914964ae837d7acbcdf9dc74b5a0f29;p=m6w6%2Fext-http diff --git a/http_message_object.c b/http_message_object.c index 3d2e727..7069e6a 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -278,8 +278,8 @@ void _http_message_object_reverse(zval *this_ptr, zval *return_value TSRMLS_DC) void _http_message_object_prepend_ex(zval *this_ptr, zval *prepend, zend_bool top TSRMLS_DC) { zval m; - http_message *save_parent_msg; - zend_object_value save_parent_obj; + http_message *save_parent_msg = NULL; + zend_object_value save_parent_obj = {0, NULL}; getObject(http_message_object, obj); getObjectEx(http_message_object, prepend_obj, prepend); @@ -596,7 +596,7 @@ static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC) getObjectEx(http_message_object, obj, object); http_message *msg = obj->message; HashTable *props = OBJ_PROP(obj); - zval array; + zval array, *parent; INIT_ZARR(array, props); @@ -651,6 +651,14 @@ static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC) zend_hash_copy(Z_ARRVAL_P(headers), &msg->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); ASSOC_PROP(array, zval, "headers", headers); ASSOC_STRINGL(array, "body", PHPSTR_VAL(msg), PHPSTR_LEN(msg)); + + MAKE_STD_ZVAL(parent); + if (msg->parent) { + ZVAL_OBJVAL(parent, obj->parent, 1); + } else { + ZVAL_NULL(parent); + } + ASSOC_PROP(array, zval, "parentMessage", parent); return OBJ_PROP(obj); }