Edit report at http://pear.php.net/bugs/bug.php?id=17086&edit=1
ID: 17086
Updated by: till@php.net
Reported By: bluespire at gmail dot com
Summary: URLs with urlencoding break Query Variables when
runing unsetQueryVariable
-Status: Open
+Status: Bogus
Type: Bug
Package: Net_URL2
Operating System: BSD
Package Version: 0.3.1
PHP Version: 5.2.5
-Assigned To:
+Assigned To: till
Roadmap Versions:
New Comment:
-Status: Open
+Status: Bogus
-Assigned To:
+Assigned To: till
Sorry, but your problem does not imply a bug in PEAR itself. For a
list of more appropriate places to ask for help using PEAR, please
visit http://pear.php.net/support/ as this bug system is not the
appropriate forum for asking support questions.
Thank you for your interest in PEAR.
Hey,
for starters, it's next to impossible to determine if a string is
already encoded - one way or the other. Let alone
determine if percentage encoding or something else was used.
It's just one too many assumptions to make. If you can think of a
feasible way to do this, feel free to re-open, until then
we won't attempt this.
Till
Previous Comments:
------------------------------------------------------------------------
[2010-02-11 20:25:59] woo
Description:
------------
Net_URL2 uses rawurlencode/rawurldecode, so URLs that contain query
values that were encoded with urlencode become broken when
unsetQueryVariable is used.
Example:
$net_url = new Net_URL2("http://www.test.com/?var=hello+friend");
$net_url->unsetQueryVariable('toggle');
$url_query_string = $net_url->getQuery();
The result is "var=hello%2Bfriend"
If you do not use unsetQUeryVariable it works fine:
$net_url = new Net_URL2("http://www.test.com/?var=hello+friend");
$url_query_string = $net_url->getQuery();
The result is "var=hello+friend"
Test script:
---------------
$net_url = new Net_URL2("http://www.test.com/?var=hello+friend");
$net_url->unsetQueryVariable('toggle');
$url_query_string = $net_url->getQuery();
echo "problem: $url_query_string<br />";
$net_url = new Net_URL2("http://www.test.com/?var=hello+friend");
$url_query_string = $net_url->getQuery();
echo "no problem: $url_query_string";
Expected result:
----------------
Both situatiosn should result in either a string of "var=hello+friend"
or "var=hello%20friend" (preferably the former to keep consistent
encoding formats)
Actual result:
--------------
problem var=hello%2Bfriend
no problem: var=hello+friend
------------------------------------------------------------------------