tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.18k stars 1.51k forks source link

PHP 8.x: "Implicit conversion from float xxx to int loses precision" in TCPDF::Write() line 6411 - unncecessary/pointless array_walk($chrw, array($this, 'getRawCharWidth'));? #599

Open dev-maniac opened 1 year ago

dev-maniac commented 1 year ago

On PHP 8.x I get the deprecation message "Implicit conversion from float xxx to int loses precision" when writing a line via TCPDF::Write()

It traces back to array_walk($chrw, array($this, 'getRawCharWidth')); which seems rather pointless to me. getRawCharWidth() expects parameter to be an character code (ord), but $chrw already contains calculated character widths and getRawCharWidth() would only return the character width and does not store anything or modify the original value via reference. So array_walk does nothing, if I understand correctly. Comparing $chrw before and after array_walk also yields same result.