PHP warning

count(): Parameter must be an array or an object that implements Countable

/var/www/yii-1.1.13/framework/web/CArrayDataProvider.php(119)

107         foreach($this->getData() as $i=>$data)
108             $keys[$i]=is_object($data) ? $data->{$this->keyField} : $data[$this->keyField];
109         return $keys;
110     }
111 
112     /**
113      * Calculates the total number of data items.
114      * This method simply returns the number of elements in {@link rawData}.
115      * @return integer the total number of data items.
116      */
117     protected function calculateTotalItemCount()
118     {
119         return count($this->rawData);
120     }
121 
122     /**
123      * Sorts the raw data according to the specified sorting instructions.
124      * After calling this method, {@link rawData} will be modified.
125      * @param array $directions the sorting directions (field name => whether it is descending sort)
126      */
127     protected function sortData($directions)
128     {
129         if(empty($directions))
130             return;
131         $args=array();

Stack Trace

#1
+
 /var/www/5-soft.com/app/protected/views/work/view_video.php(2): CDataProvider->getTotalItemCount()
1 <?php
2     $dataProvider->getTotalItemCount();
3     if (Yii::app()->request->getUrlReferrer()) {
4         $link = CHtml::link(Yii::t('app', 'Back'), Yii::app()->request->getUrlReferrer());
5     }
6     else
7     {
#6
+
 /var/www/5-soft.com/app/protected/controllers/WorkController.php(444): CController->render("view_video", array("dataProvider" => CArrayDataProvider, "works_list_id" => "video_view"))
439         }
440 
441         $dataProvider->pagination->currentPage = $num;
442         $this->render('view_video',array(
443             'dataProvider'  => $dataProvider,
444             'works_list_id' => $works_list_id,
445         ));
446     }
447 }
#21
+
 /var/www/5-soft.com/app/index.php(23): CApplication->run()
18     $langs = array('ru','en');
19     $lang = explode('_',Yii::app()->getRequest()->getPreferredLanguage());
20     $curLang = !in_array($lang[0], $langs) ? Yii::app()->language : $lang[0];
21     Yii::app()->setLanguage('en');
22 }
23 Yii::app()->run();
2024-03-28 18:33:17 Apache/2.4.38 (Debian) Yii Framework/1.1.13