summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian A. Weber2017-08-21 18:18:57 +0200
committerChristian A. Weber2017-08-21 18:18:57 +0200
commit2d2f6da0c0871059a454f3c05c537ab917ad876f (patch)
treea3d16861e5e9bb2ccc7f8ae4553b160e00328ede
parent34a0745e18910acd7f90a19dbd08ff03de2456bc (diff)
downloaditools-2d2f6da0c0871059a454f3c05c537ab917ad876f.tar.gz
itools-2d2f6da0c0871059a454f3c05c537ab917ad876f.tar.bz2
itools-2d2f6da0c0871059a454f3c05c537ab917ad876f.zip
fix multiple args in base, add documentation
-rw-r--r--it_url.class7
-rwxr-xr-xtests/it_html.t4
2 files changed, 7 insertions, 4 deletions
diff --git a/it_url.class b/it_url.class
index 5563b5e..976dceb 100644
--- a/it_url.class
+++ b/it_url.class
@@ -825,11 +825,14 @@ static function _params($params, $keys = null)
}
+/**
+ * Similar to php's parse_str() but leaves . and space in arg names intact
+ */
static function parse_str($query)
{
- foreach (explode('&', $query, 2) as $arg)
+ foreach (explode('&', $query) as $arg)
{
- list($key, $value) = explode("=", $arg, 2);
+ list($key, $value) = explode('=', $arg, 2);
$result[urldecode($key)] = urldecode($value);
}
diff --git a/tests/it_html.t b/tests/it_html.t
index 2291c54..77c441e 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -190,8 +190,8 @@ is(
);
is(
- U("/foo.html?bar=qux", array('bar' => "baz")),
- '/foo.html?bar=baz',
+ U("/foo.html?a=b&bar=qux&c=d", array('bar' => "baz")),
+ '/foo.html?a=b&bar=baz&c=d',
'U() args override get params in base url'
);