X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=php_http_message.c;h=f06065a4eb05ef138e5b09ed2ebb031a64da7961;hb=3e3f308c565cea1b153717f213d61731aef2fcf4;hp=d61644ce3de734b2c7bda3598f5d91bf643b5e7f;hpb=5aa3a33fde0e9e59a7363d40cf4b446364f0623a;p=m6w6%2Fext-http diff --git a/php_http_message.c b/php_http_message.c index d61644c..f06065a 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -86,7 +86,7 @@ php_http_message_t *php_http_message_init_env(php_http_message_t *message, php_h php_http_env_get_response_headers(&message->hdrs); if (php_output_get_level()) { if (php_output_get_status() & PHP_OUTPUT_SENT) { - php_error_docref(NULL, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_output_get_start_filename(TSRMLS_C), php_output_get_start_lineno(TSRMLS_C)); + php_error_docref(NULL, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_output_get_start_filename(), php_output_get_start_lineno()); goto error; } else if (SUCCESS != php_output_get_contents(&tval)) { php_error_docref(NULL, E_WARNING, "Could not fetch response body"); @@ -776,10 +776,11 @@ ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *msg } if (msg_obj->message) { php_http_message_body_free(&msg_obj->message->body); - msg_obj->message->body = php_http_message_body_init(&body_obj->body, NULL); + msg_obj->message->body = body_obj->body; } else { - msg_obj->message = php_http_message_init(NULL, 0, php_http_message_body_init(&body_obj->body, NULL)); + msg_obj->message = php_http_message_init(NULL, 0, body_obj->body); } + php_http_message_body_addref(body_obj->body); msg_obj->body = body_obj; return SUCCESS; @@ -817,7 +818,7 @@ php_http_message_object_t *php_http_message_object_new_ex(zend_class_entry *ce, return o; } -zend_object *php_http_message_object_clone(zval *this_ptr TSRMLS_DC) +zend_object *php_http_message_object_clone(zval *this_ptr) { php_http_message_object_t *new_obj = NULL; php_http_message_object_t *old_obj = PHP_HTTP_OBJ(NULL, this_ptr); @@ -877,6 +878,8 @@ static zval *php_http_message_object_read_prop(zval *object, zval *member, int t zval_ptr_dtor(return_value); ZVAL_COPY_VALUE(return_value, tmp); } + zend_string_release(member_name); + return return_value; } else { php_property_proxy_t *proxy; php_property_proxy_object_t *proxy_obj; @@ -885,12 +888,9 @@ static zval *php_http_message_object_read_prop(zval *object, zval *member, int t proxy_obj = php_property_proxy_object_new_ex(NULL, proxy); ZVAL_OBJ(tmp, &proxy_obj->zo); + zend_string_release(member_name); return tmp; } - - zend_string_release(member_name); - - return return_value; } static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot) @@ -1408,7 +1408,7 @@ static PHP_METHOD(HttpMessage, setResponseCode) zend_bool strict = 1; php_http_message_object_t *obj; - php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &code, &strict), invalid_arg, return); + php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "l|b", &code, &strict), invalid_arg, return); obj = PHP_HTTP_OBJ(NULL, getThis()); PHP_HTTP_MESSAGE_OBJECT_INIT(obj); @@ -1459,7 +1459,7 @@ static PHP_METHOD(HttpMessage, setResponseStatus) size_t status_len; php_http_message_object_t *obj; - php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &status, &status_len), invalid_arg, return); + php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &status, &status_len), invalid_arg, return); obj = PHP_HTTP_OBJ(NULL, getThis()); @@ -1709,7 +1709,7 @@ static PHP_METHOD(HttpMessage, unserialize) obj->message = msg; } else { obj->message = php_http_message_init(NULL, 0, NULL); - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not unserialize http\\Message"); + php_error_docref(NULL, E_ERROR, "Could not unserialize http\\Message"); } } } @@ -1831,7 +1831,7 @@ static PHP_METHOD(HttpMessage, count) { zend_long count_mode = -1; - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count_mode)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &count_mode)) { php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); PHP_HTTP_MESSAGE_OBJECT_INIT(obj);