From e51b72f0e0a4665f1e77630fe8efd384e4a560f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Thu, 27 Oct 2016 16:44:35 +0200 Subject: [PATCH] Development - Changed from http_build_query to custom solution as it doesn't support querystrings with "%" on some php versions. --- src/Pecee/SimpleRouter/RouterBase.php | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/Pecee/SimpleRouter/RouterBase.php b/src/Pecee/SimpleRouter/RouterBase.php index dea5400..49a4a2b 100644 --- a/src/Pecee/SimpleRouter/RouterBase.php +++ b/src/Pecee/SimpleRouter/RouterBase.php @@ -301,6 +301,28 @@ class RouterBase { return $this; } + public function httpBuildQuery(array $input) { + + $output = ''; + + if(count($input)) { + + $output .= '?'; + + $i = 0; + foreach ($input as $key => $value) { + $output .= $key . '=' . urlencode($value); + if (($i + 1) < count($input)) { + $output .= '&'; + } + $i++; + } + + } + + return $output; + } + public function arrayToParams(array $getParams = null, $includeEmpty = true) { if(is_array($getParams)) { @@ -310,7 +332,7 @@ class RouterBase { }); } - return http_build_query($getParams); + return $this->httpBuildQuery($getParams); } return ''; } @@ -461,8 +483,8 @@ class RouterBase { $url = '/' . trim(join('/', $url), '/') . '/'; - if($getParams !== null && count($getParams)) { - $url .= '?' . $this->arrayToParams($getParams); + if($getParams !== null) { + $url .= $this->arrayToParams($getParams); } return $url;