From 6227974c86820a4555af4f80f42f5eee988091d5 Mon Sep 17 00:00:00 2001 From: pollen8 Date: Tue, 25 Feb 2014 11:02:24 +0100 Subject: [PATCH] fixed: form submission in ie could cause an error if form action contained a single quote character --- components/com_fabrik/models/form.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/components/com_fabrik/models/form.php b/components/com_fabrik/models/form.php index abec2eb0d07..d9575254bf8 100644 --- a/components/com_fabrik/models/form.php +++ b/components/com_fabrik/models/form.php @@ -4965,8 +4965,28 @@ public function getAction() $qs[] = $k . '=' . $v; } - $action = $page . implode("&", $qs); - $action = JRoute::_($action); + $action = $page . (implode("&", $qs)); + $action = JRoute::_($action, false); + + /* + * JRoute messes up our urlencoding - re-parse the querystring part of the routed url to urlencode the values. + * Example bug was in IE with url index.php?foo=hotesse de l'air - the ' caused ie to fail on form submisssion. + */ + if (strpos($action, '?')) + { + $bits = explode('?', $action); + $pairs = explode('&', $bits[1]); + + foreach ($pairs as &$val) + { + $pairParts = explode('=', $val); + $pairParts[1] = urlencode($pairParts[1]); + $val = $pairParts[0] . '=' . $pairParts[1]; + } + + $bits[1] = implode('&', $pairs); + $action = $bits[0] . '?' . $bits[1]; + } } else {