mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing Router::reverse() not correctly working with Request objects that
contained query string parameters.
This commit is contained in:
parent
e64e29964d
commit
1c3e1df305
2 changed files with 7 additions and 2 deletions
|
@ -1084,11 +1084,14 @@ class Router {
|
|||
*/
|
||||
public static function reverse($params) {
|
||||
if ($params instanceof CakeRequest) {
|
||||
$url = $params->query;
|
||||
$params = $params->params;
|
||||
} else {
|
||||
$url = $params['url'];
|
||||
}
|
||||
$pass = $params['pass'];
|
||||
$named = $params['named'];
|
||||
$url = $params['url'];
|
||||
|
||||
unset(
|
||||
$params['pass'], $params['named'], $params['paging'], $params['models'], $params['url'], $url['url'],
|
||||
$params['autoRender'], $params['bare'], $params['requested'], $params['return']
|
||||
|
|
|
@ -2309,9 +2309,11 @@ class RouterTest extends CakeTestCase {
|
|||
'action' => 'view',
|
||||
'pass' => array(1),
|
||||
'named' => array(),
|
||||
'url' => array('url' => 'eng/posts/view/1')
|
||||
));
|
||||
$request->query = array('url' => 'eng/posts/view/1', 'test' => 'value');
|
||||
$result = Router::reverse($request);
|
||||
$expected = '/eng/posts/view/1?test=value';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue