PHP warning

Division by zero

/var/www/html/web/protected/models/database/GfsModel.php(619)

607             $tot_temp += $m->teplota;
608             $tot_cloud_n += $m->oblacnost_n;
609             $tot_cloud_s += $m->oblacnost_s;
610             $tot_cloud_v += $m->oblacnost_v;
611             $tot_wind += $m->vietor;
612             $tot_gusts += $m->vietor_naraz;
613             $tot_dir += $m->vietor_smer;
614         }
615         if ($tot_precip > 0)
616             $this->sneh = $tot_snow / $tot_precip;
617         else
618             $this->sneh = 0;
619         $this->zrazky = $tot_precip / $count;
620         $this->teplota = $tot_temp / $count;
621         $this->oblacnost_n = $tot_cloud_n / $count;
622         $this->oblacnost_s = $tot_cloud_s / $count;
623         $this->oblacnost_v = $tot_cloud_v / $count;
624         $this->vietor = $tot_wind / $count;
625         $this->vietor_naraz = $tot_gusts / $count;
626         $this->vietor_smer = $tot_dir / $count;
627     }
628 
629     /**
630      * produces abbreviated wind direction (e.g. SV, SZ, J, JV...) from numerical (angular) representation <0;360>
631      */

Stack Trace

#0
+
 /var/www/html/web/protected/modules/userprofile/controllers/BaseViewProfileController.php(150): GfsModel->makeAverage(array())
145             $criteria = new CDbCriteria();
146             $criteria->condition = 'model_point = \'' . $this->city->gfs_model_point_id . '\' and (datumcas between :start and :end)';
147             $criteria->params = array(':start' => date('Y-m-d H:i:s', $tomorrow_start), ':end' => date('Y-m-d H:i:s', $tomorrow_end));
148             $model_entries = GfsModel::model()->findAll($criteria);
149             $avg_model = new GfsModel();
150             $avg_model->makeAverage($model_entries);
151             $forecast = new PpPouzivateliaMesta();
152             $forecast->datum = date('Y-m-d', $tomorrow_start);
153             $forecast->cas = date('Y-m-d H:i:s');
154             $forecast->min_nizsia = $minmax['mi'];
155             $forecast->min_vyssia = $minmax['ma'];
#1
+
 /var/www/html/web/protected/modules/userprofile/controllers/BaseViewProfileController.php(128): BaseViewProfileController->loadForecastFromModel()
123         $criteria->order = 'cas asc';
124         $criteria->limit = 2;
125                 
126         $this->latestForecasts = PpPouzivateliaMesta::model()->findAll($criteria);
127         if (count($this->latestForecasts) == 0)
128             $this->loadForecastFromModel();
129         
130     }
131     
132     private function loadForecastFromModel() {
133         $tomorrow_start = mktime(0,0,0,date('m'), date('d') + 1, date('Y'));        
#2
+
 /var/www/html/web/protected/modules/userprofile/controllers/BaseViewProfileController.php(55): BaseViewProfileController->loadLatestForecasts()
50         $this->id = intval($_GET['id']);
51         $this->loadUserProfileInfo();
52         $this->loadPath();
53         $this->loadBreadCrumb();
54         $this->loadLatestReport();
55         $this->loadLatestForecasts();
56         $this->nacitajAktuality();
57         
58         $chain->run();
59         return true;
60         
2024-03-19 11:05:21 Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.3.2 Yii Framework/1.1.10