Fix #20689: Fix PHP 8.5 imagedestroy deprecation warning

This commit is contained in:
Dmitry Eliseev
2025-12-09 19:34:01 +03:00
committed by GitHub
parent c32d24c929
commit c50e2d1749
2 changed files with 6 additions and 1 deletions

View File

@@ -84,6 +84,7 @@ Yii Framework 2 Change Log
- Bug #20673: Sanitize `null` bytes before `quoteValue()` on PHP 8.5+ in SQLite (terabytesoftw)
- Bug #20671: Fix PHPDoc annotations in `yii\base`, `yii\console`, `yii\web` and `yii\widgets` namespaces (mspirkov)
- Bug #20675: Add generics for all controllers (mspirkov)
- Bug #20689: Fix PHP `8.5` `imagedestroy` deprecation warning (ElisDN)
2.0.53 June 27, 2025

View File

@@ -314,7 +314,11 @@ class CaptchaAction extends Action
ob_start();
imagepng($image);
imagedestroy($image);
// Function `imagedestroy` is deprecated since PHP `8.5`, as it has no effect since PHP `8.0`
if (PHP_VERSION_ID < 80000) {
imagedestroy($image);
}
return ob_get_clean();
}