PHP warning

array_push() expects parameter 1 to be array, null given

/home/t/timonovo/timonovo7/public_html/protected/components/Timetable.php(397)

385                     array_push($card['classrooms'], $this->data['classrooms'][$classroomId]['name']);
386                 sort($card['classrooms']);
387             }
388 
389             foreach ($lesson['groupIds'] as $groupId)
390             {
391                 array_push($card['groups'], array(
392                     'id' => $groupId,
393                     'isEntireClass' => $this->data['groups'][$groupId]['isEntireClass'],
394                     'name' => $this->data['groups'][$groupId]['name'])
395                 );
396             };
397             array_push($timetable['cards'][$dayIndex][$periodIndex], $card);
398             usort($timetable['cards'][$dayIndex][$periodIndex], array($this, "compareByGroupId"));
399         }
400 
401         Yii::app()->cache->set($cacheKey, $timetable, 0, new CFileCacheDependency($this->source));
402         return $timetable;
403     }
404 
405     public function getTimetableByTeacher($id)
406     {
407         $cacheKey = sprintf("teacherTimetable%d", $id);
408         $timetable = Yii::app()->cache->get($cacheKey);
409         if (is_array($timetable))

Stack Trace

#0
+
 /home/t/timonovo/timonovo7/public_html/protected/components/Timetable.php(397): array_push(null, array("subject" => "Я гражданин России", "teachers" => array(array("id" => 43, "name" => "Барахтян И.Н.")), "classrooms" => array("107"), "groups" => array(array("id" => 229, "isEntireClass" => true, "name" => "Весь класс"))))
392                     'id' => $groupId,
393                     'isEntireClass' => $this->data['groups'][$groupId]['isEntireClass'],
394                     'name' => $this->data['groups'][$groupId]['name'])
395                 );
396             };
397             array_push($timetable['cards'][$dayIndex][$periodIndex], $card);
398             usort($timetable['cards'][$dayIndex][$periodIndex], array($this, "compareByGroupId"));
399         }
400 
401         Yii::app()->cache->set($cacheKey, $timetable, 0, new CFileCacheDependency($this->source));
402         return $timetable;
#1
+
 /home/t/timonovo/timonovo7/public_html/protected/controllers/MainController.php(360): Timetable->getTimetableByClass(33)
355         if ($fullscreen)
356             $this->layout = "//layouts/empty";
357 
358         if (isset($_GET['classId']))
359         {
360             $timetable = Yii::app()->timetable->getTimetableByClass(intval($_GET['classId']));
361             if (empty($timetable))
362                 throw new CHttpException(404);
363             $this->pageTitle = "Расписание уроков класса – " . $timetable['class'];
364             $this->render("timetableClass", array(
365                 'timetable' => $timetable,
#9
+
 /home/t/timonovo/timonovo7/public_html/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2019-06-24 22:50:48 Apache/2.4.7 Yii Framework/1.1.14