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 » Networking » Net_URL » Bug #471

Wrong decode of query string

Details

Submitted2003-12-21 16:40 UTC
Frompaj at pearfr dot org
Assignedpajoye
StatusClosed
PackageNet_URL
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2003-12-21 16:40 UTC] paj at pearfr dot org

Description:
------------
The value and the key of each query argument should be decoded separately. The current HEAD and latest release decode the query string once at all and produces a biazed result.

In the sample code, note the last argument of the encoded URI.
quick fix (sorry, forgot to disable drop empty lines and linefied convert ;)) :
http://www.pearfr.org/~paj/pear/bug_net_url.patch

Reproduce code:
---------------
$url = 'http://example.com/pls/portal30/PORTAL30.wwpob_page.changetabs?p_back_url=http%3A%2F%2Fexample.com%2Fservlet%2Fpage%3F_pageid%3D360%2C366%2C368%2C382%26_dad%3Dportal30%26_schema%3DPORTAL30';
$neturl = new Net_URL($url);
echo $neturl->getURL();

Expected result:
----------------
http://example.com/pls/portal30/PORTAL30.wwpob_page.changetabs?p_back_url=http%3A%2F%2Fexample.com%2Fservlet%2Fpage%3F_pageid%3D360%2C366%2C368%2C382%26_dad%3Dportal30%26_schema%3DPORTAL30

Actual result:
--------------
http://example.com/pls/portal30/PORTAL30.wwpob_page.changetabs?p_back_url=http%3A%2F%2Fexample.com%2Fservlet%2Fpage%3F_pageid%3D360%2C366%2C368%2C382&_dad=portal30&_schema=PORTAL3