tecnickcom / TCPDF

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

Deprecation warnings in PHP 8.2.22 #743

Open IcetipsAlta opened 3 months ago

IcetipsAlta commented 3 months ago

I'm aware that this is the old version which is pretty much closed while the new one is in development.

After updating to the latest build of the "old" version, and also upgrading to PHP 8.2.22 I got a few deprecation warnings from PHP most notably on like 4138 and 4139 in tcpdf.php

Deprecated: Implicit conversion from float x.xxxxx to int loses precision in path\pdf_library\tcpdf.php on line 4138
Deprecated: Implicit conversion from float x.xxxxx to int loses precision in path\pdf_library\tcpdf.php on line 4139

The x.xxxxx varies and on a 2-3 page report this returns about 2,900 warnings. This refers to the getRawCharWidth method and those two lines of code:

if (isset($this->CurrentFont['cw'][$char])) {
    $w = $this->CurrentFont['cw'][$char];

Is there anything that I can do to fix this to get around this problem?

littlepackage commented 1 month ago

Is there anything that I can do to fix this to get around this problem?

Upgrade TCPDF. In the current version (6.7.6), the values are explicitly converted.