Edit report at http://pear.php.net/bugs/bug.php?id=18267&edit=1
ID: 18267
Updated by: [email protected]
Reported By: borz_off at cs dot msu dot su
Summary: setQueryVariables() fails to encode array values
-Status: Open
+Status: Feedback
Type: Bug
Package: Net_URL2
Operating System: Irrelevant
Package Version: SVN
PHP Version: Irrelevant
-Assigned To:
+Assigned To: till
Roadmap Versions:
New Comment:
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: till
When I http_build_query your example, I get:
indexed%5B0%5D=first+value&indexed%5B1%5D=second+value&indexed%5B2%5D%5B0%5D=foo&indexed%5B2%
5D%5B1%5D=bar
Does that work for you?
Previous Comments:
------------------------------------------------------------------------
[2011-02-12 22:40:00] avb
Description:
------------
setQueryVariables() does not apply urlencode() to the values that are
arrays. Also it only handles one level of depth.
Test script:
---------------
$url = new Net_URL2('http://localhost/bug.php');
$url->setQueryVariables(array('indexed' => array('first value', 'second
value', array('foo', 'bar'))));
echo $url;
Expected result:
----------------
http://localhost/bug.php?indexed[0]=first%20value&indexed[1]=second%20value&indexed[2][0]=foo&indexed[2][1]=bar
Actual result:
--------------
http://localhost/bug.php?indexed[0]=first value&indexed[1]=second
value&indexed[2]=Array
------------------------------------------------------------------------