Skip to content

Commit

Permalink
- Added fix to bug #6470 (Still testing)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.php.net/repository/pear/packages/Net_URL/trunk@235194 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
David Coallier committed May 8, 2007
1 parent d5c789b commit e914467
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion URL.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
//
// Net_URL Class

define ('NET_URL_ENCODE_QUERY_KEYS', false);

class Net_URL
{
/**
Expand Down Expand Up @@ -231,6 +233,10 @@ function getURL()
*/
function addQueryString($name, $value, $preencoded = false)
{
if (NET_URL_ENCODE_QUERY_KEYS) {
$name = rawurlencode($name);
}

if ($preencoded) {
$this->querystring[$name] = $value;
} else {
Expand All @@ -246,6 +252,10 @@ function addQueryString($name, $value, $preencoded = false)
*/
function removeQueryString($name)
{
if (NET_URL_ENCODE_QUERY_STRING) {
$name = rawurlencode($name);
}

if (isset($this->querystring[$name])) {
unset($this->querystring[$name]);
}
Expand Down Expand Up @@ -314,7 +324,9 @@ function _parseRawQuerystring($querystring)
$key = $part;
}

$key = rawurldecode($key);
if (!NET_URL_ENCODE_QUERY_KEYS) {
$key = rawurldecode($key);
}

if (preg_match('#^(.*)\[([0-9a-z_-]*)\]#i', $key, $matches)) {
$key = $matches[1];
Expand Down

0 comments on commit e914467

Please sign in to comment.