PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_URL » Bug #3260

Problem with duplicate names in query string

Details

Submitted2005-01-21 18:58 UTC
Fromtony dot whyman at helios-is dot com
StatusWont fix
PackageNet_URL
PHP Version4.3.9
OSlinux
Roadmaps(Not assigned)

Comments

[2005-01-21 18:58 UTC] tony dot whyman at helios-is dot com

Description:
------------
I came across this problem using HTTP_Request and writing a PHP front end for Bugzilla. The Bugzilla query page is unusual in that the form uses the get method and includes a listbox which can return multiple values. If you do this then the query string has several name/value pairs with the same name (bugstatus).

HTTP_Request uses Net_URL to handle the query string.

Net_URL uses a single associative array to hold the name/value pairs. It cannot handle the case where there is more than one name/value pair with the same name and loses all but the last. The behaviour is the same whether or not you use the "raw" query string method or not.

Reproduce code:
---------------
url->addQueryString('bugstatus','NEW');
url->addQueryString('bugstatus','ASSIGNED');

Expected result:
----------------
query.cgi?bugstatus=NEW&bugstatus=ASSIGNED

Actual result:
--------------
query.cgi?bugstatus=ASSIGNED

[2005-01-23 16:22 UTC] tony dot whyman at helios-is dot com

Thanks for the suggestion. I'll try it out, although your suggestion does mean that I have to know in advance that the name/value pair is multi-valued :(