Skip to content

Commit c50e2d1

Browse files
authored
Fix #20689: Fix PHP 8.5 imagedestroy deprecation warning
1 parent c32d24c commit c50e2d1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

framework/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Yii Framework 2 Change Log
8484
- Bug #20673: Sanitize `null` bytes before `quoteValue()` on PHP 8.5+ in SQLite (terabytesoftw)
8585
- Bug #20671: Fix PHPDoc annotations in `yii\base`, `yii\console`, `yii\web` and `yii\widgets` namespaces (mspirkov)
8686
- Bug #20675: Add generics for all controllers (mspirkov)
87+
- Bug #20689: Fix PHP `8.5` `imagedestroy` deprecation warning (ElisDN)
8788

8889

8990
2.0.53 June 27, 2025

framework/captcha/CaptchaAction.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,11 @@ protected function renderImageByGD($code)
314314

315315
ob_start();
316316
imagepng($image);
317-
imagedestroy($image);
317+
318+
// Function `imagedestroy` is deprecated since PHP `8.5`, as it has no effect since PHP `8.0`
319+
if (PHP_VERSION_ID < 80000) {
320+
imagedestroy($image);
321+
}
318322

319323
return ob_get_clean();
320324
}

0 commit comments

Comments
 (0)