PHP 8. Conversion from float to int loses precision in file: line 1391. Fixed.
[fa-stable.git] / reporting / includes / class.graphic.inc
index c4bc69f6abb79b025b999e8490a9bec32771df51..1c43674a58dea4142d36eace25ba1471340bc4c7 100644 (file)
@@ -1218,6 +1218,8 @@ class Chart
 
        function string_width($string, $size) 
        {
+               if ($string == NULL)
+                       return $size;
                $p = imageftbbox($size, 0, $this->fontfile, $string);
                return $p[4] - $p[0];
        }
@@ -1226,7 +1228,7 @@ class Chart
        {
                $digits   = strlen(round($this->max_value));
                $interval = pow(10, ($digits-1));
-               $this->higher_value = round(($this->max_value - ($this->max_value % $interval) + $interval), 1);
+               $this->higher_value = round(($this->max_value - ((int)$this->max_value % $interval) + $interval), 1);
                $this->higher_value_str = $this->number_formated($this->higher_value, $this->dec1);
        }
 
@@ -1386,7 +1388,7 @@ class Chart
                        $size += 2;
                        $string = str_replace(" ", "  ", $string);
                }       
-               imagettftext($img, $size, $angle, $x, $y  + $alt, $col, $this->fontfile, $string);
+               imagettftext($img, $size, $angle, intval($x), $y  + $alt, $col, $this->fontfile, $string);
        }
 
        function hex2rgb($hex)