瀏覽代碼

Change: PHP 8.5: GdImage freed automatically

https://www.php.net/manual/en/migration85.deprecated.php#migration85.deprecated.gd
Berbe 2 周之前
父節點
當前提交
545136665c
共有 1 個文件被更改,包括 3 次插入 和 1 次删除
  1. 3 1
      lib/Vizhash16x16.php

+ 3 - 1
lib/Vizhash16x16.php

@@ -123,7 +123,9 @@ class Vizhash16x16
         imagepng($image);
         $imagedata = ob_get_contents();
         ob_end_clean();
-        imagedestroy($image);
+        if (version_compare(PHP_VERSION, '8.5', '<') && defined('imagedestroy')) {
+            imagedestroy($image);
+        }
 
         return $imagedata;
     }