Skip to content

Resolved deprecation notice regarding deprecated strlen() of null-value in Write() function#863

Open
samy-rd wants to merge 2 commits intotecnickcom:mainfrom
samy-rd:samy-rd-deprecation-notice
Open

Resolved deprecation notice regarding deprecated strlen() of null-value in Write() function#863
samy-rd wants to merge 2 commits intotecnickcom:mainfrom
samy-rd:samy-rd-deprecation-notice

Conversation

@samy-rd
Copy link
Copy Markdown

@samy-rd samy-rd commented Apr 8, 2026

As mentioned in #796 sometimes the following deprecation notice occurs while using strlen() on a null value (non-string) in the tcpdf->Write() function if its param $txt is null/not given.

PHP message: PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in .../tcpdf.php on line 6425;

This small fix should handle cases where $txt is null/not set.

@nicolaasuni
Copy link
Copy Markdown
Member

Thank you very much, @samy-rd, for the fix for the strlen(null) deprecation notice in Write() - keeping the library clean on PHP 8.1+ with strict deprecation reporting is important for many projects, and it is genuinely appreciated.

TCPDF 6 is now deprecated and no further changes will be merged into this repository. Please see the pinned issue Thank You - and the Future of TCPDF for the full explanation and the path forward.

Null-safety throughout the codebase is enforced by PHPStan in tc-lib-pdf, so deprecation notices of this kind do not arise. If you encounter a related issue there, feel free to open a PR or issue.

I am leaving this PR open in case you or anyone else wishes to continue the discussion, but it is unlikely that this PR will ever be merged.

Thank you again for your patience and understanding.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants