mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-03-05 13:30:32 -05:00
handle PHP 8.2 deprecation
PHP 8.2 deprecates implicit conversion from float to int if it loses precision, hence the explicit conversion. PHP 8.1 deprecates the (optional since PHP 8.0) 3rd parameter of imagefilledpolygon(), but 7.3 & 7.4 require it.
This commit is contained in:
@@ -109,9 +109,9 @@ class Vizhash16x16
|
||||
for ($i = 0; $i < 7; ++$i) {
|
||||
$action = $this->getInt();
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
$r = $r0 = ($r0 + $this->getInt() / 25) % 256;
|
||||
$g = $g0 = ($g0 + $this->getInt() / 25) % 256;
|
||||
$b = $b0 = ($b0 + $this->getInt() / 25) % 256;
|
||||
$r = $r0 = ((int) $r0 + $this->getInt() / 25) % 256;
|
||||
$g = $g0 = ((int) $g0 + $this->getInt() / 25) % 256;
|
||||
$b = $b0 = ((int) $b0 + $this->getInt() / 25) % 256;
|
||||
$this->drawshape($image, $action, $color);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class Vizhash16x16
|
||||
{
|
||||
$v = $this->VALUES[$this->VALUES_INDEX];
|
||||
++$this->VALUES_INDEX;
|
||||
$this->VALUES_INDEX %= count($this->VALUES); // Warp around the array
|
||||
$this->VALUES_INDEX %= count($this->VALUES); // Wrap around the array
|
||||
return $v;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ class Vizhash16x16
|
||||
*/
|
||||
private function getX()
|
||||
{
|
||||
return $this->width * $this->getInt() / 256;
|
||||
return (int) $this->width * $this->getInt() / 256;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,7 +159,7 @@ class Vizhash16x16
|
||||
*/
|
||||
private function getY()
|
||||
{
|
||||
return $this->height * $this->getInt() / 256;
|
||||
return (int) $this->height * $this->getInt() / 256;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,9 +190,9 @@ class Vizhash16x16
|
||||
($color2[2] - $color1[2]) / $size,
|
||||
);
|
||||
for ($i = 0; $i < $size; ++$i) {
|
||||
$r = $color1[0] + ($diffs[0] * $i);
|
||||
$g = $color1[1] + ($diffs[1] * $i);
|
||||
$b = $color1[2] + ($diffs[2] * $i);
|
||||
$r = $color1[0] + ((int) $diffs[0] * $i);
|
||||
$g = $color1[1] + ((int) $diffs[1] * $i);
|
||||
$b = $color1[2] + ((int) $diffs[2] * $i);
|
||||
if ($direction == 'h') {
|
||||
imageline($img, $i, 0, $i, $sizeinv, imagecolorallocate($img, $r, $g, $b));
|
||||
} else {
|
||||
@@ -222,7 +222,7 @@ class Vizhash16x16
|
||||
break;
|
||||
case 3:
|
||||
$points = array($this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY());
|
||||
imagefilledpolygon($image, $points, 4, $color);
|
||||
version_compare(PHP_VERSION, '8.1', '<') ? imagefilledpolygon($image, $points, 4, $color) : imagefilledpolygon($image, $points, $color);
|
||||
break;
|
||||
default:
|
||||
$start = $this->getInt() * 360 / 256;
|
||||
|
||||
Reference in New Issue
Block a user