php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58519 http_request_body_encode
Submitted: 2009-01-26 04:32 UTC Modified: 2009-02-16 10:45 UTC
From: bbaron at bbaron dot sk Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.2.5 OS: linux
Private report: No CVE-ID: None
 [2009-01-26 04:32 UTC] bbaron at bbaron dot sk
Description:
------------
http_request_body_encode - not work with array recursion for $fields


Reproduce code:
---------------
<?
$data = array('user'=>array('name'=>'Bob Smith',
                            'age'=>47,
                            'sex'=>'M',
                            'dob'=>'5/12/1956'),
              'pastimes'=>array('golf', 'opera', 'poker', 'rap'),
              'children'=>array('bobby'=>array('age'=>12,
                                               'sex'=>'M'),
                                'sally'=>array('age'=>8,
                                               'sex'=>'F')),
              'CEO');
echo (http_request_body_encode($data, array(__FILE__)));
?>

Expected result:
----------------
Content-Type: multipart/form-data; boundary=----------------------------6a9046bbcfa7
------------------------------6a9046bbcfa7
Content-Disposition: form-data; name="user[name]"

Bob Smith
------------------------------6a9046bbcfa7
Content-Disposition: form-data; name="user[age]"

47
------------------------------6a9046bbcfa7
Content-Disposition: form-data; name="user[sex]"

M
------------------------------6a9046bbcfa7--
etc

Actual result:
--------------
Content-Type: multipart/form-data; boundary=----------------------------6a9046bbcfa7
------------------------------6a9046bbcfa7
Content-Disposition: form-data; name="user"

Array
------------------------------6a9046bbcfa7
Content-Disposition: form-data; name="pastimes"

Array
------------------------------6a9046bbcfa7
Content-Disposition: form-data; name="children"

Array
------------------------------6a9046bbcfa7--

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-12 11:54 UTC] mike@php.net
Recategorized as feature request.
 [2009-02-16 10:45 UTC] mike@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 19 22:03:37 2021 UTC