[limb-svn] r7020 - in 3.x/trunk/limb/net: src tests/cases
svn at limb-project.com
svn at limb-project.com
Fri May 16 17:06:41 MSD 2008
Author: hidrarg
Date: 2008-05-16 17:06:40 +0400 (Fri, 16 May 2008)
New Revision: 7020
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7020
Modified:
3.x/trunk/limb/net/src/lmbUri.class.php
3.x/trunk/limb/net/tests/cases/lmbUriTest.class.php
Log:
-- function toString() - return valid string, if url="?foo=' . urlencode('10&foo=11')"
Modified: 3.x/trunk/limb/net/src/lmbUri.class.php
===================================================================
--- 3.x/trunk/limb/net/src/lmbUri.class.php 2008-05-15 12:18:46 UTC (rev 7019)
+++ 3.x/trunk/limb/net/src/lmbUri.class.php 2008-05-16 13:06:40 UTC (rev 7020)
@@ -296,7 +296,7 @@
$string = '';
if(in_array('path', $parts))
- $string .= $this->path;
+ $string .= $this->getPath();
if(in_array('query', $parts))
{
@@ -356,9 +356,7 @@
function addQueryItem($name, $value)
{
- $this->query_items[$name] = is_array($value) ?
- lmbArrayHelper :: arrayMapRecursive('urlencode', $value) :
- urlencode($value);
+ $this->query_items[$name] = $value;
}
function getQueryItem($name)
@@ -420,7 +418,7 @@
foreach($flat_array as $key => $value)
{
if($value != '' || is_null($value))
- $query_items[] = $key . '=' . $value;
+ $query_items[] = $key . '=' . urlencode($value);
else
$query_items[] = $key;
}
@@ -437,11 +435,11 @@
protected function _parseQueryString($query_string)
{
parse_str($query_string, $arr);
-
+
foreach($arr as $key => $item)
{
if(!is_array($item))
- $arr[$key] = rawurldecode($item);
+ $arr[$key] = urldecode($item);
}
return $arr;
Modified: 3.x/trunk/limb/net/tests/cases/lmbUriTest.class.php
===================================================================
--- 3.x/trunk/limb/net/tests/cases/lmbUriTest.class.php 2008-05-15 12:18:46 UTC (rev 7019)
+++ 3.x/trunk/limb/net/tests/cases/lmbUriTest.class.php 2008-05-16 13:06:40 UTC (rev 7020)
@@ -584,6 +584,16 @@
$uri = new lmbUri('index.html?wow=' . urlencode('what a nice weather'));
$this->assertEqual($uri->getQueryItem('wow'), 'what a nice weather');
}
+
+ function testToString_IfAttributeNoValidStringURL()
+ {
+ $str = 'http://admin:test@localhost:81/test.php?foo=' . urlencode('10&b=11') . '#23';
+
+ $uri = new lmbUri($str);
+
+ $this->assertEqual($uri->toString(), $str);
+ }
+
}
More information about the limb-svn
mailing list