Page 1 of 1

TCPDF failed after upgrade to PHP8 on ArchLinux

Posted: Sat Jan 30, 2021 8:46 am
by hf2094
Hello,

after upgrade to PHP 8.0 report generation fails - see error message below.
The problem does not occur, when the report size is only 1 page.
See also php.ini and report example in attachment.
My system is an Up-To-Date ArchLinux with nuBuilder-4.5 from GIT (last git-pull Jan, 29).

Yours (Mit freundlichen GrĂ¼ssen) Hf


[Sat Jan 30 08:00:55.827172 2021] [php:error] [pid 5637] [client 127.0.0.1:33282] PHP Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, bool given in /srv/http/nubuilder/core/libs/tcpdf/include/tcpdf_fonts.php:2002\n
Stack trace:\n
#0 /srv/http/nubuilder/core/libs/tcpdf/include/tcpdf_fonts.php(2002): array_map()\n
#1 /srv/http/nubuilder/core/libs/tcpdf/tcpdf.php(4056): TCPDF_FONTS::UTF8StringToArray()\n
#2 /srv/http/nubuilder/core/nurunpdf.php(695): TCPDF->GetStringWidth()\n
#3 /srv/http/nubuilder/core/nurunpdf.php(642): nuSECTION->getOneRow()\n
#4 /srv/http/nubuilder/core/nurunpdf.php(392): nuSECTION->getObjectRows()\n
#5 /srv/http/nubuilder/core/nurunpdf.php(343): nuSECTION->setObjectLines()\n
#6 /srv/http/nubuilder/core/nurunpdf.php(256): nuSECTION->buildSection()\n
#7 /srv/http/nubuilder/core/nurunpdf.php(59): nuBuildReport()\n
#8 {main}\n
thrown in /srv/http/nubuilder/core/libs/tcpdf/include/tcpdf_fonts.php on line 2002,
referer: http://....

Re: TCPDF failed after upgrade to PHP8 on ArchLinux

Posted: Sat Jan 30, 2021 10:28 am
by kev1n
Unfortunately I could not reproduce the issue (PHP 8, latest nuBuilder 4.5.)
Would it be possible to upload a sample DB?

Re: TCPDF failed after upgrade to PHP8 on ArchLinux

Posted: Sat Jan 30, 2021 3:26 pm
by hf2094
Hello,
I found the problem - but not the solution. The problem lays in TCPDF. TCPDF cannot deal with German Umlauts. The error occurs only, when there is a Umlaut in a report field. Reports with no Umlauts are generated as expected.
About two years ago I had a similar problem with TCPDF. Then I took TCPDF from GIT and put it into nuBuilder.

I'll keep you informed..
Yours (Mit freundlichen GrĂ¼ssen) Hf

Re: TCPDF failed after upgrade to PHP8 on ArchLinux

Posted: Sat Jan 30, 2021 4:54 pm
by kev1n
Try it with the modified tcpdf.php in the attachment.

Replace this file: core/libs/tcpdf/tcpdf.php

Re: TCPDF failed after upgrade to PHP8 on ArchLinux

Posted: Sat Jan 30, 2021 7:53 pm
by hf2094
Hello,
thank you for your reply. It never gets to this point you mention in you code . When I start the report I get an empty screen instead of the report and the error message in .../http/error_log.

I put a echo ($str) into nubuilder/core/libs/tcpdf/include/tcpdf_fonts.php:2001. See attachment for output: It breaks when a Umlaut is detected.

More precisely: It failes only in php8 if a line break shall be inserted into a text string with Umlaut.
There is no problem with Umlaut in short strings and no problem with long strings with no Umlaut.
It is a problem of tcpdf with php 8.

Thank you for your support
Hf