Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding support for a trailing & or & in the existing queryString

  • Loading branch information...
commit 07735069fad116d205fd97cb539f7b6241a1e6ce 1 parent 45a96ae
Jelle Henkens jellehenkens authored
2  lib/Cake/Routing/Router.php
View
@@ -964,7 +964,7 @@ public static function queryString($q, $extra = array(), $escape = false) {
}
$addition = http_build_query($q, null, $join);
- if ($out && $addition) {
+ if ($out && $addition && substr($out, strlen($join) * -1, strlen($join)) != $join) {
$out .= $join;
}
8 lib/Cake/Test/Case/Routing/RouterTest.php
View
@@ -2626,5 +2626,13 @@ public function testQueryString() {
$result = Router::queryString('foo=bar', array('php' => 'nut', 'jose' => 'zap'), true);
$expected = '?foo=bar&php=nut&jose=zap';
$this->assertEquals($expected, $result);
+
+ $result = Router::queryString('foo=bar&', array('php' => 'nut', 'jose' => 'zap'), true);
+ $expected = '?foo=bar&php=nut&jose=zap';
+ $this->assertEquals($expected, $result);
+
+ $result = Router::queryString('foo=bar&', array('php' => 'nut', 'jose' => 'zap'));
+ $expected = '?foo=bar&php=nut&jose=zap';
+ $this->assertEquals($expected, $result);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.