diff --git a/tcpdf.php b/tcpdf.php index a1b4c1c..3bba7b0 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -7737,6 +7737,7 @@ class TCPDF { return ''; } + protected static $cleaned_ids = array(); /** * Unset all class variables except the following critical variables. * @param $destroyall (boolean) if true destroys all class variables, otherwise preserves critical variables. @@ -7749,7 +7750,11 @@ class TCPDF { if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) { mb_internal_encoding($this->internal_encoding); } + if (isset(self::$cleaned_ids[$this->file_id])) { + $destroyall = false; + } if ($destroyall AND !$preserve_objcopy) { + self::$cleaned_ids[$this->file_id] = true; // remove all temporary files $tmpfiles = glob(K_PATH_CACHE.'__tcpdf_'.$this->file_id.'_*'); if (!empty($tmpfiles)) {