Skip to content

Commit

Permalink
! A few captcha images, typically the static ones, were being deleted…
Browse files Browse the repository at this point in the history
… twice. Once in Subs-Captcha.php, and once in their class' destructor. (captcha-grid.php, captcha-ledicons.php, captcha-ledicons_anim.php, captcha-silhouette.php, captcha-stripes.php)
  • Loading branch information
Nao committed Mar 29, 2017
1 parent b42ffae commit 2f082c8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/app/captcha/captcha-grid.php
Expand Up @@ -43,7 +43,7 @@ public function render($code)
public function __destruct()
{
// Make sure we clean up the main image when we're done.
if (!empty($this->image))
if (is_resource($this->image))
@imagedestroy($this->image);
}
}
2 changes: 1 addition & 1 deletion core/app/captcha/captcha-ledicons.php
Expand Up @@ -215,7 +215,7 @@ protected function load_font()
public function __destruct()
{
// Make sure we clean up the main image when we're done.
if (!empty($this->image))
if (is_resource($this->image))
@imagedestroy($this->image);

// Make sure we clean up any leds we created. Doing it this way means we have freedom later if we expand this to multi-colored or something.
Expand Down
2 changes: 1 addition & 1 deletion core/app/captcha/captcha-ledicons_anim.php
Expand Up @@ -137,7 +137,7 @@ protected function create_led($id, $background = false, $lowlight_col = '', $hig

protected function paint_led($id, $x, $y, $image = null)
{
imagecopy ($image, $this->leds[$id], $x, $y, 0, 0, 4, 4);
imagecopy($image, $this->leds[$id], $x, $y, 0, 0, 4, 4);
}

protected function assign_colors($image)
Expand Down
2 changes: 1 addition & 1 deletion core/app/captcha/captcha-silhouette.php
Expand Up @@ -45,7 +45,7 @@ public function render($code)
public function __destruct()
{
// Make sure we clean up the main image when we're done.
if (!empty($this->image))
if (is_resource($this->image))
@imagedestroy($this->image);
}
}
2 changes: 1 addition & 1 deletion core/app/captcha/captcha-stripes.php
Expand Up @@ -76,7 +76,7 @@ public function render($code)
public function __destruct()
{
// Make sure we clean up the main image when we're done.
if (!empty($this->image))
if (is_resource($this->image))
@imagedestroy($this->image);
}
}

0 comments on commit 2f082c8

Please sign in to comment.