mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding support for a trailing & or & in the existing queryString
This commit is contained in:
parent
7a1275a1b1
commit
484c3ec688
2 changed files with 9 additions and 1 deletions
|
@ -964,7 +964,7 @@ class Router {
|
||||||
}
|
}
|
||||||
$addition = http_build_query($q, null, $join);
|
$addition = http_build_query($q, null, $join);
|
||||||
|
|
||||||
if ($out && $addition) {
|
if ($out && $addition && substr($out, strlen($join) * -1, strlen($join)) != $join) {
|
||||||
$out .= $join;
|
$out .= $join;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2626,5 +2626,13 @@ class RouterTest extends CakeTestCase {
|
||||||
$result = Router::queryString('foo=bar', array('php' => 'nut', 'jose' => 'zap'), true);
|
$result = Router::queryString('foo=bar', array('php' => 'nut', 'jose' => 'zap'), true);
|
||||||
$expected = '?foo=bar&php=nut&jose=zap';
|
$expected = '?foo=bar&php=nut&jose=zap';
|
||||||
$this->assertEquals($expected, $result);
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue