Skip to content

PHP 8.5 deprecation: imagedestroy() has no effect since PHP 8.0 #4

Description

@mxmsmnv

Environment

  • PHP 8.5
  • FieldtypeQRCode.module
  • GIF QR-code output (generateRawQRCode($text, false, ...))

Problem

Generating a GIF QR code emits:

PHP Deprecated: Function imagedestroy() is deprecated since 8.5, as it has no effect since PHP 8.0

The call is currently made after imagegif($im) in FieldtypeQRCode::generateRawQRCode().

Suggested change

Only call imagedestroy() on PHP versions older than 8.0, or remove the call if PHP 8+ is the minimum supported version:

imagegif($im);
if (PHP_VERSION_ID < 80000) {
    imagedestroy($im);
}

GD objects are released automatically on PHP 8+, so this preserves compatibility with older PHP versions while avoiding the PHP 8.5 deprecation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions