Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.1.2

Bug #18267 setQueryVariables() fails to encode array values
Submitted: 2011-02-13 03:40 UTC
From: avb Assigned: till
Status: Closed Package: Net_URL2 (version SVN)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 12 + 2 = ?

 
 [2011-02-13 03:40 UTC] avb (Alexey Borzov)
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

Comments

 [2011-03-13 07:15 UTC] till (Till Klampaeckel)
-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?
 [2011-03-13 07:57 UTC] till (Till Klampaeckel)
-Status: Feedback +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Took another crack at it. Should be fixed in SVN, please give feedback!