Skip to content

PHP 8.5 deprecation: null array offset in _destroy() when file_id is null #852

@kolotov

Description

@kolotov

Description

In PHP 8.5, using null as an array offset is deprecated. The _destroy() method in tcpdf.php accesses self::$cleaned_ids[$this->file_id] without checking if $this->file_id is null first, triggering:

Deprecated: Using null as an array offset is deprecated, use an empty string instead

This happens at line 7891 (self::$cleaned_ids[$this->file_id]).

Steps to reproduce

  1. Use PHP 8.5
  2. Generate any PDF — the deprecation warning is triggered in the destructor chain

Suggested fix

Add an early return in _destroy() when $this->file_id is null, before accessing self::$cleaned_ids.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions