Skip to content

Commit

Permalink
Fix error in paginatorhelper that prevented URL generation.
Browse files Browse the repository at this point in the history
Fix errors in URL generation where page numbers were always broken.
  • Loading branch information
markstory committed Nov 21, 2013
1 parent 26b69b4 commit 7cedb26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cake/Test/TestCase/View/Helper/PaginatorHelperTest.php
Expand Up @@ -700,12 +700,12 @@ public function testPassedArgsMergingWithUrlOptions() {
);

$this->Paginator->request->params['pass'] = array(2);
$this->Paginator->request->query = array('foo' => 'bar', 'x' => 'y');
$this->Paginator->request->query = array('page' => 1, 'foo' => 'bar', 'x' => 'y');
$this->Paginator->beforeRender(null, 'posts/index');

$result = $this->Paginator->sort('title');
$expected = array(
'a' => array('href' => '/articles/index/2?sort=title&direction=asc&foo=bar&x=y'),
'a' => array('href' => '/articles/index/2?foo=bar&x=y&sort=title&direction=asc'),
'Title',
'/a'
);
Expand Down
5 changes: 1 addition & 4 deletions Cake/View/Helper/PaginatorHelper.php
Expand Up @@ -113,10 +113,7 @@ public function templates($templates = null) {
* @return void
*/
public function beforeRender($event, $viewFile) {
$this->options['url'] = array_merge($this->request->params['pass']);
if (!empty($this->request->query)) {
$this->options['url']['?'] = $this->request->query;
}
$this->options['url'] = array_merge($this->request->params['pass'], $this->request->query);
}

/**
Expand Down

0 comments on commit 7cedb26

Please sign in to comment.