From 6cd6568f84367673c54a67269424aa77dcc7e213 Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Tue, 6 Sep 2005 22:24:31 +0000 Subject: [PATCH] make_categories_list(): initialize variables correctly to cover up for broken call convention. Passing unset variables by ref to be populated is a BAD idea. Do The Right Thing and Return your function output or there'll be no dessert for you. --- course/lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/course/lib.php b/course/lib.php index 95e6628de47..7761f9d50ec 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1129,6 +1129,14 @@ function make_categories_list(&$list, &$parents, $category=NULL, $path="") { /// categories, building up a nice list for display. It also makes /// an array that list all the parents for each category. + // initialize the arrays if needed + if (!is_array($list)) { + $list = array(); + } + if (!is_array($parents)) { + $parents = array(); + } + if ($category) { if ($path) { $path = $path.' / '.$category->name;