X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_object.c;h=8ff7b25ed21fcb98874fa877f5f23d3572e80fd6;hp=6b0d6b076bcefdb1db4504a07c7fd3d3e09085c6;hb=7b88d9022c90eb12e5fe195af8644935141c9d68;hpb=24a9fbbdd1666d8bffb5cb771544f73fbf9a4ff1 diff --git a/http_request_object.c b/http_request_object.c index 6b0d6b0..8ff7b25 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -32,8 +32,6 @@ #include "php_http_request_pool_api.h" #include "php_http_url_api.h" -ZEND_EXTERN_MODULE_GLOBALS(http); - #define HTTP_BEGIN_ARGS(method, ret_ref, req_args) HTTP_BEGIN_ARGS_EX(HttpRequest, method, ret_ref, req_args) #define HTTP_EMPTY_ARGS(method, ret_ref) HTTP_EMPTY_ARGS_EX(HttpRequest, method, ret_ref) #define HTTP_REQUEST_ME(method, visibility) PHP_ME(HttpRequest, method, HTTP_ARGS(HttpRequest, method), visibility) @@ -1196,7 +1194,7 @@ PHP_METHOD(HttpRequest, setPostFields) MAKE_STD_ZVAL(post); array_init(post); - if (post_data && (Z_TYPE_P(post_data) == IS_ARRAY)) { + if (post_data && zend_hash_num_elements(Z_ARRVAL_P(post_data))) { array_copy(post_data, post); } SET_PROP(obj, postFields, post); @@ -1359,6 +1357,7 @@ PHP_METHOD(HttpRequest, addPostFile) } add_next_index_zval(new_post, entry); SET_PROP(obj, postFiles, new_post); + zval_ptr_dtor(&new_post); RETURN_TRUE; }