projects
/
fa-stable.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bddfd18
)
PHP 8 deprecated parameter in imagefilledpolygon. More float to int problems. Only...
author
Joe
<joe.hunt.consulting@gmail.com>
Thu, 22 Sep 2022 09:49:19 +0000
(11:49 +0200)
committer
Joe
<joe.hunt.consulting@gmail.com>
Thu, 22 Sep 2022 09:49:19 +0000
(11:49 +0200)
reporting/includes/class.graphic.inc
patch
|
blob
|
history
diff --git
a/reporting/includes/class.graphic.inc
b/reporting/includes/class.graphic.inc
index 1c43674a58dea4142d36eace25ba1471340bc4c7..0a3591afa575d97923d8d4796669d70aa76c16a4 100644
(file)
--- a/
reporting/includes/class.graphic.inc
+++ b/
reporting/includes/class.graphic.inc
@@
-330,9
+330,9
@@
class Chart
for ($i = 1; $i < 10; $i++)
{
$dec_y = $i * ($this->higher_value_size / 10);
for ($i = 1; $i < 10; $i++)
{
$dec_y = $i * ($this->higher_value_size / 10);
- $x1 =
$this->graphic_area_x1
;
- $y1 =
$this->graphic_area_y2 - $dec_y
;
- $x2 =
$this->graphic_area_x2
;
+ $x1 =
round($this->graphic_area_x1)
;
+ $y1 =
round($this->graphic_area_y2 - $dec_y)
;
+ $x2 =
round($this->graphic_area_x2)
;
$y2 = $y1;
if ($this->stream == 'svg')
$this->svg->line($x1, $y1, $x2, $y2, $this->color['bg_lines']);
$y2 = $y1;
if ($this->stream == 'svg')
$this->svg->line($x1, $y1, $x2, $y2, $this->color['bg_lines']);
@@
-835,13
+835,13
@@
class Chart
$j = $n - 1;
while ($i + 1 < $j) {
$k = $i + ($j - $i) / 2;
$j = $n - 1;
while ($i + 1 < $j) {
$k = $i + ($j - $i) / 2;
- if ($x <= $splines[
$k
]['x']) {
+ if ($x <= $splines[
round($k)
]['x']) {
$j = $k;
} else {
$i = $k;
}
}
$j = $k;
} else {
$i = $k;
}
}
- $s = $splines[
$j
];
+ $s = $splines[
round($j)
];
}
}
$dx = ($x - $s['x']);
}
}
$dx = ($x - $s['x']);
@@
-1228,7
+1228,7
@@
class Chart
{
$digits = strlen(round($this->max_value));
$interval = pow(10, ($digits-1));
{
$digits = strlen(round($this->max_value));
$interval = pow(10, ($digits-1));
- $this->higher_value = round(($this->max_value - (
(int)$this->max_value
% $interval) + $interval), 1);
+ $this->higher_value = round(($this->max_value - (
round($this->max_value)
% $interval) + $interval), 1);
$this->higher_value_str = $this->number_formated($this->higher_value, $this->dec1);
}
$this->higher_value_str = $this->number_formated($this->higher_value, $this->dec1);
}
@@
-1345,8
+1345,14
@@
class Chart
round($x2 + (1+$k)*$a), round($y2 - (1-$k)*$a),
round($x2 + (1-$k)*$a), round($y2 + (1+$k)*$a),
);
round($x2 + (1+$k)*$a), round($y2 - (1-$k)*$a),
round($x2 + (1-$k)*$a), round($y2 + (1+$k)*$a),
);
- imagefilledpolygon($image, $points, 4, $color);
- return imagepolygon($image, $points, 4, $color);
+ if (PHP_MAJOR_VERSION >= 8) { // num_points is deprecated
+ imagefilledpolygon($image, $points, $color);
+ return imagepolygon($image, $points, $color);
+ }
+ else {
+ imagefilledpolygon($image, $points, 4, $color);
+ return imagepolygon($image, $points, 4, $color);
+ }
}
function _imagestring($img, $size, $x, $y, $string, $col, $alt=0, $angle=0, $align=false)
}
function _imagestring($img, $size, $x, $y, $string, $col, $alt=0, $angle=0, $align=false)
@@
-1388,7
+1394,7
@@
class Chart
$size += 2;
$string = str_replace(" ", " ", $string);
}
$size += 2;
$string = str_replace(" ", " ", $string);
}
- imagettftext($img, $size, $angle,
intval
($x), $y + $alt, $col, $this->fontfile, $string);
+ imagettftext($img, $size, $angle,
round
($x), $y + $alt, $col, $this->fontfile, $string);
}
function hex2rgb($hex)
}
function hex2rgb($hex)