cakephp/cakephp — pull request #1495 by dereuromark (2013-08-08 10:31:54+00:00)
Title: options in paginator url() can sometimes be null

Since a few days/weeks ago we encounter a strange issue with the Paginator helper in our productive 2.3.8 versions running. The error logs fill up with:

Warning: Warning (2): array_merge() [http://php.net/function.array-merge]: Argument #1 is not an array in [/.../lib/Cake/View/Helper/PaginatorHelper.php, line 403]
Trace:
array_merge - [internal], line ??
PaginatorHelper::url() - CORE/Cake/View/Helper/PaginatorHelper.php, line 403
PaginatorHelper::link() - CORE/Cake/View/Helper/PaginatorHelper.php, line 386
PaginatorHelper::sort() - CORE/Cake/View/Helper/PaginatorHelper.php, line 353
include - APP/View/Elements/pagination.ctp, line 28

as well as as:

Warning: Warning (2): array_filter() expects parameter 1 to be array, null given in [/.../lib/Cake/View/Helper/PaginatorHelper.php, line 403]
Trace:
array_filter - [internal], line ??
PaginatorHelper::url() - CORE/Cake/View/Helper/PaginatorHelper.php, line 403
PaginatorHelper::link() - CORE/Cake/View/Helper/PaginatorHelper.php, line 386
PaginatorHelper::sort() - CORE/Cake/View/Helper/PaginatorHelper.php, line 353
include - APP/View/Elements/pagination.ctp, line 28

Line 28 merely states:

Paginator->sort('distance', null, array('direction'=>'asc'));?> | Paginator->sort('price', null, array('direction'=>'asc'));?>

Seems like `$paging['options']` can be null in some cases, thus the access as array is not healthy.

A similar issue reported here (in an older version probably):
http://stackoverflow.com/questions/18123095/cakephp-paginator-array-error