PHP warning

Division by zero

/var/www/html/web/protected/models/database/PredpovednyModel.php(644)

632             $tot_temp += $m->teplota;
633             $tot_cloud_n += $m->oblacnost_n;
634             $tot_cloud_s += $m->oblacnost_s;
635             $tot_cloud_v += $m->oblacnost_v;
636             $tot_wind += $m->vietor;
637             $tot_gusts += $m->vietor_naraz;
638             $tot_dir += $m->vietor_smer;
639         }
640         if ($tot_precip > 0)
641             $this->sneh = $tot_snow / $tot_precip;
642         else
643             $this->sneh = 0;
644         $this->zrazky = $tot_precip / $count;
645         $this->teplota = $tot_temp / $count;
646         $this->oblacnost_n = $tot_cloud_n / $count;
647         $this->oblacnost_s = $tot_cloud_s / $count;
648         $this->oblacnost_v = $tot_cloud_v / $count;
649         $this->vietor = $tot_wind / $count;
650         $this->vietor_naraz = $tot_gusts / $count;
651         $this->vietor_smer = $tot_dir / $count;
652     }
653 
654     /**
655      * produces abbreviated wind direction (e.g. SV, SZ, J, JV...) from numerical (angular) representation <0;360>
656      */

Stack Trace

#0
+
 /var/www/html/web/protected/controllers/MeteoWidgetController.php(97): PredpovednyModel->makeAverage(array())
092                 $max = $r->teplota;
093             if ($r->teplota < $min)
094                 $min = $r->teplota;
095         }
096         $model = new PredpovednyModel();
097         $model->makeAverage($array_to_avg);
098         return array('max' => $max, 'min' => $min, 'icon' => $model->getOverallIcon());
099     }
100     
101     
102     
#1
+
 /var/www/html/web/protected/controllers/MeteoWidgetController.php(54): MeteoWidgetController->loadDay(1710802800)
49         $this->results = array();
50         $day_offset = (date('H') < 17) ? 0 : 1;
51         $start_date = mktime(0,0,0,date('m'), date('d') + $day_offset, date('Y'));
52         for ($i = 0; $i <= 2; $i++) {
53             $offset = mktime(0,0,0,date('m', $start_date), date('d', $start_date) + $i, date('Y', $start_date));
54             $this->results[$offset] = $this->loadDay($offset);    
55         }        
56         
57         
58     }
59     
#2
+
 /var/www/html/web/protected/views/meteoWidget/index.php(8): MeteoWidgetController->load()
03         $cache_token = (isset($_GET['path']) ? $_GET['path'] :'' ).  '-' . $this->format;
04         if (isset($_GET['lon']) && isset($_GET['lat']))
05             $cache_token = "lon-{$_GET['lon']}-lat-{$_GET['lat']}-{$this->format}";
06 
07         if ($this->beginCache('meteowidget-' . $cache_token, array('duration' =>  $duration))) {
08             $this->load();
09             $cityname = ($this->city == null) ? 'xxx' : $this->city->nazov;
10             $url = Yii::app()->urlManager->createUrl('/detailLokality', array('path' => $_GET['path']))
11             ?>
12 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
13    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2024-03-19 06:06:33 Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.3.2 Yii Framework/1.1.10