From 0c57e3ce71a90b5aaa3008a81bf63bf381fee42f Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Tue, 19 Aug 2025 17:35:15 +0700 Subject: [PATCH 1/2] refactor: remove `imagedestroy` has no effect since PHP 8.0 --- system/Images/Handlers/GDHandler.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/system/Images/Handlers/GDHandler.php b/system/Images/Handlers/GDHandler.php index 12ea4e1a72e2..71e77a12bbf2 100644 --- a/system/Images/Handlers/GDHandler.php +++ b/system/Images/Handlers/GDHandler.php @@ -56,9 +56,6 @@ protected function _rotate(int $angle): bool // Rotate it! $destImg = imagerotate($srcImg, $angle, $white); - // Kill the file handles - imagedestroy($srcImg); - $this->resource = $destImg; return true; @@ -87,9 +84,6 @@ protected function _flatten(int $red = 255, int $green = 255, int $blue = 255) imagefilledrectangle($dest, 0, 0, $this->width, $this->height, $matte); imagecopy($dest, $srcImg, 0, 0, 0, 0, $this->width, $this->height); - // Kill the file handles - imagedestroy($srcImg); - $this->resource = $dest; return $this; @@ -192,7 +186,6 @@ protected function process(string $action) $copy($dest, $src, 0, 0, (int) $this->xAxis, (int) $this->yAxis, $this->width, $this->height, $origWidth, $origHeight); - imagedestroy($src); $this->resource = $dest; return $this; @@ -281,8 +274,6 @@ public function save(?string $target = null, int $quality = 90): bool throw ImageException::forInvalidImageCreate(); } - imagedestroy($this->resource); - chmod($target, $this->filePermissions); return true; From ae65deb5b64aab5eaea8727cbecf4be7696c5921 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Tue, 19 Aug 2025 19:29:32 +0700 Subject: [PATCH 2/2] fix: set null properties resource --- system/Images/Handlers/GDHandler.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/Images/Handlers/GDHandler.php b/system/Images/Handlers/GDHandler.php index 71e77a12bbf2..01c05384c744 100644 --- a/system/Images/Handlers/GDHandler.php +++ b/system/Images/Handlers/GDHandler.php @@ -274,6 +274,8 @@ public function save(?string $target = null, int $quality = 90): bool throw ImageException::forInvalidImageCreate(); } + $this->resource = null; + chmod($target, $this->filePermissions); return true;