Description: [PATCH] Fix null array offset in _destroy() for PHP 8.5
Author: Georgii Kolotov <skab.working@gmail.com>
Origin: vendor, https://github.com/tecnickcom/TCPDF/commit/5342602eb1da0cc69a496dce90eb46b511bd922c
Bug: https://github.com/tecnickcom/TCPDF/issues/852
Reviewed-by: Renan Rodrigo <rr@ubuntu.com>
Last-Update: 2026-02-18
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/

diff --git a/tcpdf.php b/tcpdf.php
index 2cbbc4d7..f894d221 100644
--- a/tcpdf.php
+++ b/tcpdf.php
@@ -7884,7 +7884,7 @@ public function Output($name='doc.pdf', $dest='I') {
 	 * @since 4.5.016 (2009-02-24)
 	 */
 	public function _destroy($destroyall=false, $preserve_objcopy=false) {
-		if (isset(self::$cleaned_ids[$this->file_id])) {
+		if (isset($this->file_id) && isset(self::$cleaned_ids[$this->file_id])) {
 			$destroyall = false;
 		}
 		if ($destroyall AND !$preserve_objcopy && isset($this->file_id)) {
