diff --git a/inc/class.schedule.php b/inc/class.schedule.php --- a/inc/class.schedule.php +++ b/inc/class.schedule.php @@ -154,6 +154,19 @@ class Schedule //-------------------------------------------------- function findPossibilities() { + /* + * Clean crud (completely empty courses) out of the + * schedule. For some crud, it's much easier to detect that + * it's crud now than during parsing of postData[]. + */ + foreach ($this->courses as $i => $course) + if (!$course->getnsections()) + { + unset($this->courses[$i]); + $this->courses = array_values($this->courses); + return $this->findPossibilities(); + } + $this->possiblePermutations = 1; /* special case: there is nothing entered into the schedule and thus there is one, NULL permutation */ if (!count($this->courses)) diff --git a/process.php b/process.php --- a/process.php +++ b/process.php @@ -178,7 +178,7 @@ if(!$DEBUG) /* Skip the section name, which isn't a section */ if(is_array($section)) { - $error_string = $allClasses->addSection($class['name'], $section['letter'], $section['start'], $section['end'], arrayToDays($section['days'], 'alpha'), $section['synonym'], $section['professor'], $section['location'], $section['type']); + $error_string = $allClasses->addSection($class['name'], $section['letter'], $section['start'], $section['end'], arrayToDays(empty($section['days']) ? array() : $section['days'], 'alpha'), $section['synonym'], $section['professor'], $section['location'], $section['type']); if ($error_string !== NULL) $errors[] = $error_string; }