- create a request body only if there's something to feed into http_request_body_fill()
authorMichael Wallner <mike@php.net>
Sat, 7 Jan 2006 17:02:27 +0000 (17:02 +0000)
committerMichael Wallner <mike@php.net>
Sat, 7 Jan 2006 17:02:27 +0000 (17:02 +0000)
http_request_object.c

index c8fe26d0334185fd30de4f8bf14c4be1ce953314..ad6e43202b1b421c88773427ad1dd2e06d89675d 100644 (file)
@@ -503,8 +503,10 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_
                                fields = (Z_TYPE_P(zfields) == IS_ARRAY) ? Z_ARRVAL_P(zfields) : NULL;
                                files = (Z_TYPE_P(zfiles) == IS_ARRAY) ? Z_ARRVAL_P(zfiles) : NULL;
                                
-                               if (!(obj->request->body = http_request_body_fill(obj->request->body, fields, files))) {
-                                       status = FAILURE;
+                               if ((fields && zend_hash_num_elements(fields)) || (files && zend_hash_num_elements(files))) {
+                                       if (!(obj->request->body = http_request_body_fill(obj->request->body, fields, files))) {
+                                               status = FAILURE;
+                                       }
                                }
                        }
                }