Skip to content

Commit 3c10cc1

Browse files
authored
refactor: remove imagedestroy has no effect since PHP 8.0 (#9688)
* refactor: remove `imagedestroy` has no effect since PHP 8.0 * fix: set null properties resource
1 parent ae08d14 commit 3c10cc1

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

system/Images/Handlers/GDHandler.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ protected function _rotate(int $angle): bool
5656
// Rotate it!
5757
$destImg = imagerotate($srcImg, $angle, $white);
5858

59-
// Kill the file handles
60-
imagedestroy($srcImg);
61-
6259
$this->resource = $destImg;
6360

6461
return true;
@@ -87,9 +84,6 @@ protected function _flatten(int $red = 255, int $green = 255, int $blue = 255)
8784
imagefilledrectangle($dest, 0, 0, $this->width, $this->height, $matte);
8885
imagecopy($dest, $srcImg, 0, 0, 0, 0, $this->width, $this->height);
8986

90-
// Kill the file handles
91-
imagedestroy($srcImg);
92-
9387
$this->resource = $dest;
9488

9589
return $this;
@@ -192,7 +186,6 @@ protected function process(string $action)
192186

193187
$copy($dest, $src, 0, 0, (int) $this->xAxis, (int) $this->yAxis, $this->width, $this->height, $origWidth, $origHeight);
194188

195-
imagedestroy($src);
196189
$this->resource = $dest;
197190

198191
return $this;
@@ -281,7 +274,7 @@ public function save(?string $target = null, int $quality = 90): bool
281274
throw ImageException::forInvalidImageCreate();
282275
}
283276

284-
imagedestroy($this->resource);
277+
$this->resource = null;
285278

286279
chmod($target, $this->filePermissions);
287280

0 commit comments

Comments
 (0)