Skip to content

Commit

Permalink
Get rid of several PHP 8.2 deprecated warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Lochmann committed Mar 31, 2024
1 parent 864ba75 commit 7e2fe12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion StorageAdapter/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function storeAudioData($captchaId, $audioData)
public function get($captchaId, $what = null)
{
if (isset($_SESSION['securimage_data'][$captchaId])) {
return $_SESSION['securimage_data'][$captchaId];
return unserialize($_SESSION['securimage_data'][$captchaId]);
}

return null;
Expand Down
15 changes: 11 additions & 4 deletions securimage.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,13 @@ class Securimage
*/
protected $gdlinecolor;

/**
* The GD color for the noise color
*
* @var int
*/
protected $gdnoisecolor;

/**
* The GD color for the signature text color
*
Expand Down Expand Up @@ -1980,15 +1987,15 @@ protected function distortedCopy()
$amp = array(); // amplitude
$x = ($this->image_width / 4); // lowest x coordinate of a pole
$maxX = $this->image_width - $x; // maximum x coordinate of a pole
$dx = mt_rand($x / 10, $x); // horizontal distance between poles
$dx = mt_rand(intval($x / 10), intval($x)); // horizontal distance between poles
$y = mt_rand(20, $this->image_height - 20); // random y coord
$dy = mt_rand(20, round($this->image_height * 0.7, 0)); // y distance
$minY = 20; // minimum y coordinate
$maxY = $this->image_height - 20; // maximum y cooddinate

// make array of poles AKA attractor points
for ($i = 0; $i < $numpoles; ++ $i) {
$px[$i] = ($x + ($dx * $i)) % $maxX;
for ($i = 0; $i < $numpoles; ++ $i) {
$px[$i] = (intval($x) + ($dx * $i)) % intval($maxX);
$py[$i] = ($y + ($dy * $i)) % $maxY + $minY;
$rad[$i] = mt_rand($this->image_height * 0.4, $this->image_height * 0.8);
$tmp = ((- $this->frand()) * 0.15) - .15;
Expand Down Expand Up @@ -2044,7 +2051,7 @@ protected function drawLines()

$theta = ($this->frand() - 0.5) * M_PI * 0.33;
$w = $this->image_width;
$len = mt_rand($w * 0.4, $w * 0.7);
$len = mt_rand(intval($w * 0.4), intval($w * 0.7));
$lwid = mt_rand(0, 2);

$k = $this->frand() * 0.6 + 0.2;
Expand Down

0 comments on commit 7e2fe12

Please sign in to comment.