PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTTP » HTTP_Request » Bug #4880

Bug with addRawPostData

Details

Submitted2005-07-22 09:56 UTC
Fromadministrateur at w-game dot net
StatusBogus
PackageHTTP_Request
PHP Version5.0.4
OSWindows
Roadmaps(Not assigned)

Comments

[2005-07-22 09:56 UTC] administrateur at w-game dot net

Description:
------------
Hello,
I tried to use HTTP_Request with https to post data and fetch a web page. While I wanted to post serveral data (not already encoded) I wrote this code :

$req =& new HTTP_Request('my_url');
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$req->addRawPostData($postdata,false);

with postdata an array of parameter.
I had this reponse (somethind like that) : urlencode can not work as an array.
I found that you already work arround it (with _arrayMapRecursive) but didn't apply it to addRawPostData.
So I suggest to replace line 520 (function addRawPostData) :
$this->_postData = $preencoded ? $postdata : urlencode($postdata);
by
$this->_postData = $preencoded ? $postdata : $this->_arrayMapRecursive('urlencode', $postdata);
which seems to work well.

[2005-07-22 12:32 UTC] administrateur at w-game dot net

And what about adding this new function to pass all the post parameters in one call with an array ?