- fix resetting post fields
[m6w6/ext-http] / http_request_object.c
index 6b0d6b076bcefdb1db4504a07c7fd3d3e09085c6..bf271105162e66c6c2e5f4fe717977bf0740bb3a 100644 (file)
@@ -1196,7 +1196,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);