Permalink
Browse files

make_categories_list(): initialize variables correctly to cover up fo…

…r 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.
  • Loading branch information...
1 parent 6fcc3fa commit 6cd6568f84367673c54a67269424aa77dcc7e213 martinlanghoff committed Sep 6, 2005
Showing with 8 additions and 0 deletions.
  1. +8 −0 course/lib.php
View
@@ -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;

0 comments on commit 6cd6568

Please sign in to comment.