Skip to content

Commit

Permalink
API Report::get_reports() returns native array (fixes #8096)
Browse files Browse the repository at this point in the history
Used to return ArrayList, but since 9d74c99 its no
longer using keys, which they functionality using these return
values rely on. Hence the breakage of ReportAdmin,
since no report was being detected as "current" by looking
through the array keys.
  • Loading branch information
chillu committed Dec 12, 2012
1 parent f4128a0 commit 2e164ea
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions code/reports/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static public function get_excluded_reports() {

/**
* Return the SS_Report objects making up the given list.
* @return ArrayList an arraylist of SS_Report objects
* @return Array of SS_Report objects
*/
static public function get_reports() {
$reports = ClassInfo::subclassesFor(get_called_class());
Expand All @@ -182,13 +182,12 @@ static public function get_reports() {
}
}

//convert array into ArrayList
$list = ArrayList::create($reportsArray);
uasort($reportsArray, function($a, $b) {
if($a->sort == $b->sort) return 0;
else return ($a->sort < $b->sort) ? -1 : 1;
});

//sort
$list = $list->sort('sort');

return $list;
return $reportsArray;
}

/////////////////////// UI METHODS ///////////////////////
Expand Down

0 comments on commit 2e164ea

Please sign in to comment.