summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_url.class2
-rw-r--r--tests/U_tests.json6
2 files changed, 7 insertions, 1 deletions
diff --git a/it_url.class b/it_url.class
index 30a1e41..8a78075 100644
--- a/it_url.class
+++ b/it_url.class
@@ -721,7 +721,7 @@ static function _params($params, $keys = null, $finalize = true)
foreach (it_url::_params($params[$key], null, false) as $value)
{
if (strlen($value))
- $result[] = it::replace(array('^([^=\[]*)' => $key . '[$1]'), $value);
+ $result[] = it::replace(array('^([^=\[]*)' => urlencode($key) . '[$1]'), $value);
}
}
else if (strlen($params[$key]))
diff --git a/tests/U_tests.json b/tests/U_tests.json
index 591fdc9..e35ff9d 100644
--- a/tests/U_tests.json
+++ b/tests/U_tests.json
@@ -201,5 +201,11 @@
"args": ["app://settings"],
"exp": "app://settings",
"name": "U() do not add / for non-http url without path"
+ },
+
+ {
+ "args": ["/foo.html", {"<spam>": {"<spam>": "ham"}}],
+ "exp": "/foo.html?%3Cspam%3E%5B%3Cspam%3E%5D=ham",
+ "name": "U() urlencode keys of nested structures"
}
]