TCPDF icon indicating copy to clipboard operation
TCPDF copied to clipboard

PHP8.2 deprecated warnings in getHtmlDomArray() in tcpdf.php

Open Magellanth opened this issue 1 year ago • 1 comments

My log shows following deprecated warnings regarding the file tcpdf/tcpdf.php

E_DEPRECATED: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in line 16396
E_DEPRECATED: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in line 16404
E_DEPRECATED: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in line 16427
E_DEPRECATED: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in line 16442

So obviously the function getHtmlDomArray($html) gets called with $html = null

I do not know how to reproduce this, i just see the logs in my productive environment. PHP 8.2 and TCPDF 6.6.5 is in use.

Magellanth avatar Nov 29 '23 12:11 Magellanth

After line 17064 (17070), there is a condition where $dom[$key]['thead'] can be set as false.

Line 18909 it checks $dom[$key]['thead']) for empty string condition but false/boolean returns false for the tcpdf_static.php empty_string() method (e.g. false is not an empty string) so $this->thead becomes false...

So, just a thought, maybe this happens when thead is false (and not a string) in line 3741 of tcpdf.php.

littlepackage avatar Dec 02 '23 16:12 littlepackage