升级框架及稳定依赖,修复路由、鉴权、种子、动态属性和 PHP 8.5 弃用问题。 固化 ThinkCaptcha 和 ORM 的 PHP 8.5 兼容补丁;Composer 安装会自动应用并由 patches.lock.json 锁定。 验证:45 条迁移、依赖校验与安全审计、验证码 PNG 响应及关键页面/API 回归通过。
24 lines
867 B
Diff
24 lines
867 B
Diff
diff --git a/src/Captcha.php b/src/Captcha.php
|
|
index 737b9437..7db426c4 100644
|
|
--- a/src/Captcha.php
|
|
+++ b/src/Captcha.php
|
|
@@ -237,7 +237,8 @@ class Captcha
|
|
// 输出图像
|
|
imagepng($this->im);
|
|
$content = ob_get_clean();
|
|
- imagedestroy($this->im);
|
|
+ // PHP 8.0+ frees GD images automatically; imagedestroy() is deprecated
|
|
+ // in PHP 8.5 and therefore must not be called by the request handler.
|
|
|
|
// API调用模式
|
|
if ($this->api) {
|
|
@@ -349,6 +350,6 @@ class Captcha
|
|
[$width, $height] = @getimagesize($gb);
|
|
// Resample
|
|
$bgImage = @imagecreatefromjpeg($gb);
|
|
@imagecopyresampled($this->im, $bgImage, 0, 0, 0, 0, $this->imageW, $this->imageH, $width, $height);
|
|
- @imagedestroy($bgImage);
|
|
+ // GD images are automatically released by PHP 8.0+.
|
|
}
|
|
}
|