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

urlencoding in addQueryString()

Details

Submitted2005-03-19 11:41 UTC
Frommipo at amatrica dot lt
StatusBogus
PackageNet_URL
PHP Version4.3.10
OSwindows 2000
Roadmaps(Not assigned)

Comments

[2005-03-19 11:41 UTC] mipo at amatrica dot lt

Description:
------------
Documentation of addQueryString() of third argument says:
* @param bool $preencoded Whether value is urlencoded or not, default = not

But it does conversely.
Line 235 of 'Net/URl.php' from:
'if ($preencoded) {'
should be changed to:
'if (!$preencoded) {'

Reproduce code:
---------------
require_once 'Net/URL.php';
$url = new Net_URL();
$url->addQueryString('param', '%s');
echo $url->getURL();

Expected result:
----------------
http://localhost/index.php?param=%25s

Actual result:
--------------
http://localhost/index.php?param=%s

[2005-03-19 11:45 UTC] mipo at amatrica dot lt

Expected result should be counterchanged with Actual result, i. e.:
Actual result:
http://localhost/index.php?param=%25s
Expected result:
http://localhost/index.php?param=%s

[2005-04-04 11:52 UTC] mipo at amatrica dot lt

Hi,
I have checked revision 1.41 in CVS and problem still remains - documentation of addQueryString() says that value is not urencoded by default, but method does conversely.
Line 186 from 'if ($preencoded) {' should be changed to 'if (!$preencoded) {'.