Skip to content

Commit 9baabd2

Browse files
authored
PHP 8.5: Prevent deprecation notices for imagedestroy
`imagedestroy` is deprecated in PHP 8.5+, and hasn't been doing anything since PHP 8.0. To prevent deprecation warnings it should therefore be called on older versions of PHP only. See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_no-op_functions_from_the_resource_to_object_conversion.
1 parent ff7195c commit 9baabd2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/PhpSpreadsheet/Worksheet/MemoryDrawing.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ public function __construct()
6565
public function __destruct()
6666
{
6767
if ($this->imageResource) {
68-
@imagedestroy($this->imageResource);
68+
if (\PHP_VERSION_ID < 80000) {
69+
@imagedestroy($this->imageResource);
70+
}
6971
$this->imageResource = null;
7072
}
7173
$this->worksheet = null;

0 commit comments

Comments
 (0)