Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1000619: tcpdf: Failing testsuite with PHP 8.1

1,121 views
Skip to first unread message

David Prévot

unread,
Nov 25, 2021, 6:00:05 PM11/25/21
to
Package: php-tcpdf
Version: 6.4.2+dfsg1-1
Severity: normal
Control: block 976811 by -1

Hi,

Now that PHP 8.1 is default in experimental (soon in unstable), we
noticed the testsuite is currently failing due to deprecation notices.

https://release.debian.org/britney/pseudo-excuses-experimental.html#php-defaults
https://ci.debian.net/data/autopkgtest/unstable/amd64/t/tcpdf/16973890/log.gz
[…]
Deprecated: Implicit conversion from float 16.912810673130803 to int loses precision in /usr/share/php/tcpdf/tcpdf.php on line 7360

Deprecated: Implicit conversion from float 5.388921932205105 to int loses precision in /usr/share/php/tcpdf/tcpdf.php on line 7360

Deprecated: Implicit conversion from float 0.20696933481202212 to int loses precision in /usr/share/php/tcpdf/tcpdf.php on line 7360

Deprecated: Implicit conversion from float 0.006000286595066149 to int loses precision in /usr/share/php/tcpdf/tcpdf.php on line 7360

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/tcpdf/tcpdf.php:7360) in /usr/share/php/tcpdf/tcpdf.php on line 7709
<strong>TCPDF ERROR: </strong>Some data has already been output to browser, can't send PDF file
---------------------------
[…]

A quick look upstream makes me think a patch is already available.

PHP 8.1: Fix implicit conversion from float to int #387
https://github.com/tecnickcom/TCPDF/pull/387

Thanks in advance for fixing this issue.

Regards

David
signature.asc

William Desportes

unread,
Dec 5, 2021, 6:00:04 AM12/5/21
to
Hi David,

Thanks for the research, it seems not to be was was fixed but I found
this issue that reports exactly the error on the 7360 line:
https://github.com/tecnickcom/TCPDF/issues/437
<https://github.com/tecnickcom/TCPDF/issues/437> that I seem to have
been aware of in: https://github.com/tecnickcom/TCPDF/issues/401
<https://github.com/tecnickcom/TCPDF/issues/401>

Reading
https://ci.debian.net/data/autopkgtest/unstable/amd64/t/tcpdf/16973890/log.gz
<https://ci.debian.net/data/autopkgtest/unstable/amd64/t/tcpdf/16973890/log.gz>
I could find the following errors:

examples/example_012.php <--------- The example file is wrong, it should respect the phpdoc types
---------------------------
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /usr/share/php/tcpdf/tcpdf.php on line 11680
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /usr/share/php/tcpdf/tcpdf.php on line 11753
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /usr/share/php/tcpdf/tcpdf.php on line 11972
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /usr/share/php/tcpdf/tcpdf.php on line 12175

examples/example_016.php <------------- No idea on how to fix this
---------------------------
Deprecated: Implicit conversion from float 52.2 to int loses precision in /usr/share/php/tcpdf/include/tcpdf_static.php on line 501

examples/example_030.php <------------- Forcing cast to int should fix it
---------------------------
Deprecated: Implicit conversion from float 21626.55 to int loses precision in /usr/share/php/tcpdf/tcpdf.php on line 14511

examples/example_042.php <------------- As said inhttps://github.com/tecnickcom/TCPDF/issues/401 <https://github.com/tecnickcom/TCPDF/issues/401> cast to int (https://github.com/tecnickcom/TCPDF/blob/6.4.2/tcpdf.php#L7360)
---------------------------

Deprecated: Implicit conversion from float 0.006000286595066149 to int loses precision in /usr/share/php/tcpdf/tcpdf.php on line 7360

examples/example_050.php <------------- TODO
---------------------------
Deprecated: Automatic conversion of false to array is deprecated in tcpdf_barcodes_2d.php on line 319


I already started to debug this locally, will need more time to finish.

But it seems like in some cases the examples are not using values that
are expected as the phpdoc says.

So maybe only examples files should be updated ?


William
0 new messages