Opened 14 years ago
Closed 14 years ago
#13730 closed defect (bug) (fixed)
http_request() fails when passed an array for the $body parameter
Reported by: | mdawaffe | Owned by: | westi |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | HTTP API | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Passing an empty array to WP_Http::request in the body argument causes an error if the WP_Http_ExtHTTP transport is used:
WP_Http::request( $url, array( 'body' => array() ) );
Since the body is empty, it gets ignored and so does not get converted into a (string) http query; it's passed straight into
@http_request($r['method'], $url, $r['body'], $options, $info);
Which causes an error.
Attached sets empty bodies to the default (null).
Attachments (1)
Change History (6)
#1
follow-up:
↓ 3
@
14 years ago
- Component changed from General to HTTP
- Milestone changed from Unassigned to 3.1
- Owner set to westi
- Status changed from new to reviewing
- Version set to 3.0
#2
@
14 years ago
Thanks for fixing the component/version.
It's triggered by a plugin I'm writing :)
I honestly don't know how often people will run into this bug because the HTTP extension is rarely installed. When it is installed, though, it's the preferred transport.
So it's possible a small number of people will get hit with this bug constantly and silently because of the error suppression on http://core.trac.wordpress.org/browser/trunk/wp-includes/class-http.php?rev=15144#L1216
That looks sane.
Is this bug triggered by any core code or a popular plugin?