mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-06 00:04:07 +01:00
Fixes #4061: Fixed "Fatal Error: Nesting level too deep - recursive dependency" error in CArrayDataProvider
This commit is contained in:
committed by
Alexander Makarov
parent
283506909a
commit
9ffe1da7a9
@@ -129,7 +129,7 @@ class CArrayDataProvider extends CDataProvider
|
||||
*/
|
||||
protected function sortData($directions)
|
||||
{
|
||||
if(empty($directions))
|
||||
if(empty($directions) || empty($this->rawData))
|
||||
return;
|
||||
$args=array();
|
||||
$dummy=array();
|
||||
@@ -147,6 +147,13 @@ class CArrayDataProvider extends CDataProvider
|
||||
$dummy[]=&$direction;
|
||||
unset($direction);
|
||||
}
|
||||
|
||||
// This fix is used for cases when main sorting specified by columns has equal values
|
||||
// Without it it will lead to Fatal Error: Nesting level too deep - recursive dependency?
|
||||
$args[] = range(1, count($this->rawData));
|
||||
$args[] = SORT_ASC;
|
||||
$args[] = SORT_NUMERIC;
|
||||
|
||||
$args[]=&$this->rawData;
|
||||
call_user_func_array('array_multisort', $args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user