summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_html.class2
-rwxr-xr-xtests/it_html.t6
2 files changed, 7 insertions, 1 deletions
diff --git a/it_html.class b/it_html.class
index b526bcf..9216615 100644
--- a/it_html.class
+++ b/it_html.class
@@ -437,7 +437,7 @@ function u(/* ... */)
$base = $_SERVER['PHP_SELF'];
$base = preg_replace('|\0|', '', $base);
- $base = preg_replace('|[^\w.+!*(),:?@&=/~$-]|e', 'urlencode("$0")', $base);
+ $base = preg_replace('|[^\w.+!*(),:?@&=/~$-]|e', 'urlencode(stripslashes("$0"))', $base); # Single quotes are escaped with slash by preg_replace, remove it for urlencode
$base = preg_replace('|^(\w+:)?//[^/]*$|', '$0/', $base); # Add slash if absolute url without a path, e.g. http://gna.ch
$queryparams = it_url::params($params);
$separator = strpos($base, "?") === false ? "?" : "&";
diff --git a/tests/it_html.t b/tests/it_html.t
index 005b8a7..75a8c69 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -125,5 +125,11 @@ is(
'U() with nested arrays'
);
+is(
+ U("Jet d'eau"),
+ 'Jet+d%27eau',
+ 'U() with single quotes in URL',
+);
+
?>