PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTTP » HTTP_Request » Bug #1041

Cannot add same GET/POST parameter more than once

Details

Submitted2004-03-20 19:35 UTC
Fromhakan at lisas dot de
StatusBogus
PackageHTTP_Request
PHP Version4.3.4
OSDebian Linux unstable
Roadmaps(Not assigned)

Comments

[2004-03-20 19:35 UTC] hakan at lisas dot de

Description:
------------
I have following URL:
http://www.dasoertliche.de/DB4Web/es/oetb2suche/home.htm?okey=61252427+08116019000+737..+0711+Esslingen+am+Neckar&okey=61253337+08119020000+707..+0711+Fellbach&okey=612C475D+08116078000+707..+071..+Leinfelden-Echterdingen&main=Antwort&ci=Alle+Orte&ci2=&kw=Mayer&fn=Michael&st=&hnr=&s=1&ao=0&bo=0&sim=0

where the GET-parameter 'okey' is listed more than once. So I use:
$Req->addQueryString('okey', '61252427+08116019000+737..+0711+Esslingen+am+Neckar');
$Req->addQueryString('okey', '61253337+08119020000+707..+0711+Fellbach');

But only the last 'okey' parameter is set. A quick look in the source shows me that Net/URL uses:
function addQueryString($name, $value, $preencoded = false)
{
if ($preencoded) {
$this->querystring[$name] = $value;
} else {
$this->querystring[$name] = is_array($value)? array_map('rawurlencode', $value): rawurlencode($value);
}
}

So it is clear, that the parameters with the same name are added only once. This is not so handy as shown in the above URL example.

A possible workaround or fix would be to save the querystring in an two-dimensional indexed-array, like:
$this->querystring[] = array ($name => $value);

In this case parameters with the same name are not overridden.

Expected result:
----------------
I would expect, that all parameters are added to the URL.

Actual result:
--------------
Only the last parameter is added to the URL.

[2004-03-21 20:16 UTC] hakan at lisas dot de

Ok, that works.

Thanks Hakan