The $options array passed into the curl_http_request function has a key called data. The doc comment for both curl_http_request and the drupal_http_request function says this data value should be an encoded string. The curl_http_request function deals with this as an array when posting and passes it to the drupal_http_build_query function that must take an array as its first argument. Since this is a string it causes a fatal PHP error.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1790064-query_string.patch | 461 bytes | gambaweb |
| #1 | chr_data-variable-is-a-string-not-array_1790064.patch | 654 bytes | johnennew |
Comments
Comment #1
johnennew commentedThe following patch stops the string being passed to drupal_http_build_query on a POST request if it is already a string. This should not break any implementations that assume this can be an array.
Comment #2
dariogcode commentedAlso in line 154 script assumes "data" is an string, not an array.
Comment #3
gambaweb commentedto be compatible with drupal_http_request the data when using POST should come as a query string
http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_http_request/7
the attached patch fixes chr to be compatible with that.
Comment #4
Taz commentedThe patch in #3 is still valid and good.
Very simple fix to bring this module in-line with what drupal_http_request() expects.
Comment #5
minoroffense commentedI've committed the change to the 7.x-1.x branch. It's a rather big rewrite so I manually applied the change but still gave you the attribution.
I've also done the same change for PUT requests.
Next is to port to 6.x
Comment #6
minoroffense commentedComment #7
minoroffense commented