diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-06 19:34:38 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-06 19:34:38 +0100 |
| commit | 0321f026df8e6d41df05e54bbc6222ca6588fd05 (patch) | |
| tree | 2e343be60ade7eb6cd04e8ecf2eb0f6729d3c7a0 | |
| parent | 5ee02bb733a8be57bf918b2384f12d1c47393b6f (diff) | |
| download | kernel-0321f026df8e6d41df05e54bbc6222ca6588fd05.tar.gz kernel-0321f026df8e6d41df05e54bbc6222ca6588fd05.tar.bz2 kernel-0321f026df8e6d41df05e54bbc6222ca6588fd05.zip | |
kernel: fix PHP 8.1 float-to-int deprecations in apc.php GD image code
PHP 8.1 deprecated implicit float→int narrowing. The APC admin pie and
bar chart generators pass float angle and height values directly to GD
functions (imagefilledarc, imagefilledrectangle, imageline) which require
int coordinates.
Cast $start/$end to int at the top of fill_arc() and text_arc(), $h to
int at the top of fill_box(), and the $h calculations in the bar chart
loop (case 3) inline.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rwxr-xr-x | admin/apc.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/admin/apc.php b/admin/apc.php index c28db79..6487369 100755 --- a/admin/apc.php +++ b/admin/apc.php @@ -233,6 +233,7 @@ if (isset($MYREQUEST['IMG'])) } function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$color2,$text='',$placeindex=0) { + $start = (int)$start; $end = (int)$end; $r=$diameter/2; $w=deg2rad((360+$start+($end-$start)/2)%360); @@ -261,6 +262,7 @@ if (isset($MYREQUEST['IMG'])) } function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$text,$placeindex=0) { + $start = (int)$start; $end = (int)$end; $r=$diameter/2; $w=deg2rad((360+$start+($end-$start)/2)%360); @@ -275,6 +277,7 @@ if (isset($MYREQUEST['IMG'])) function fill_box($im, $x, $y, $w, $h, $color1, $color2,$text='',$placeindex='') { global $col_black; + $h = (int)$h; $x1=$x+$w-1; $y1=$y+$h-1; @@ -399,7 +402,7 @@ if (isset($MYREQUEST['IMG'])) uasort($free, 'block_sort'); foreach($free as $block) { if($block['offset']!=$ptr) { // Used block - $h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s; + $h=(int)((GRAPH_SIZE-5)*($block['offset']-$ptr)/$s); if ($h>0) { $j++; if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($block['offset']-$ptr),$j); @@ -407,7 +410,7 @@ if (isset($MYREQUEST['IMG'])) } $y+=$h; } - $h=(GRAPH_SIZE-5)*($block['size'])/$s; + $h=(int)((GRAPH_SIZE-5)*($block['size'])/$s); if ($h>0) { $j++; if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_green,bsize($block['size']),$j); @@ -417,7 +420,7 @@ if (isset($MYREQUEST['IMG'])) $ptr = $block['offset']+$block['size']; } if ($ptr < $mem['seg_size']) { // memory at the end - $h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s; + $h = (int)((GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s); if ($h > 0) { fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++); } |
