PHP warning

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

/var/www/html/protected/controllers/SiteController.php(14031)

14019         Yii::app()->params['selfemployedDataCount'] = $selfemployedDataCount->total_records;
14020         Yii::app()->params['industrialEmployedDataCount'] = $industrialEmployedDataCount->total_records;
14021 
14022 
14023         $data = json_decode($data);
14024         // print_r($data['data']);exit;
14025         $dataProvider = new CArrayDataProvider($data->data, [
14026 
14027             'pagination' => [
14028                 'pageSize' => $limit,
14029                 'currentPage' => $page - 1, // CArrayDataProvider is 0-based
14030             ],
14031             'totalItemCount' => $data->total ?? count($data->data),
14032 
14033         ]);
14034         // echo "<pre>";
14035         // print_r($dataProvider->getData());exit;
14036 
14037 
14038 
14039         $this->render(
14040             'getSelfEmployedList',
14041             [
14042                 'dataProvider' => $dataProvider,
14043                 'pageSize' => $limit,

Stack Trace

#7
+
 /var/www/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();
2026-07-22 07:34:56 Apache/2.4.54 (Debian) Yii Framework/1.1.20