FAQ
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

------------------------------------------------------------------------

Search Discussions

  • Till at Mar 13, 2011 at 2:54 am
    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: Feedback
    +Status: Closed
    Type: Bug
    Package: Net_URL2
    Operating System: Irrelevant
    Package Version: SVN
    PHP Version: Irrelevant
    Assigned To: till
    Roadmap Versions:
    New Comment:

    -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!


    Previous Comments:
    ------------------------------------------------------------------------

    [2011-03-13 03:15:57] till

    -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-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

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedMar 13, '11 at 2:13a
activeMar 13, '11 at 2:54a
posts2
users1
websitepear.php.net

1 user in discussion

Till: 2 posts

People

Translate

site design / logo © 2023 Grokbase