Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to PHP 7.3 issues some Warnings #175

Closed
rieschl opened this issue Feb 12, 2020 · 5 comments
Closed

Updating to PHP 7.3 issues some Warnings #175

rieschl opened this issue Feb 12, 2020 · 5 comments

Comments

@rieschl
Copy link

rieschl commented Feb 12, 2020

I just tried to update my site to PHP 7.3 using the latest TCPDF version (6.3.2).
When I try to create a PDF, I get a lot of Warnings (some of them more than once)

Warning: Invalid argument supplied for foreach() in /vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 1842
Warning: array_map(): Expected parameter 2 to be an array, bool given in /vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2002
Warning: array_map(): Expected parameter 2 to be an array, null given in /vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 1781
Warning: array_merge(): Expected parameter 1 to be an array, null given in /vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2010
Warning: array_merge(): Expected parameter 2 to be an array, null given in /vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php on line 2010
Warning: count(): Parameter must be an array or an object that implements Countable in /vendor/tecnickcom/tcpdf/tcpdf.php on line 6345
Warning: max(): Array must contain at least one element in /vendor/tecnickcom/tcpdf/tcpdf.php on line 6341

Is this something I am doing wrong or are there still some issues with PHP 7.3?
All errors occur when I call the method $tcpdf->GetStringWidth().

Also I noticed, when using a non-default font, TCPDF deletes all images that have been used in $tcpdf->Image().
I had this line in the PDF: $pdf->SetFont('freesans', '', 8);. After removing it, the images were not deleted anymore.

Thank you for your help!

@nicolaasuni
Copy link
Member

would you please check again with the latest version?

@rieschl
Copy link
Author

rieschl commented Feb 12, 2020

Just updated to 6.3.3 but they are still there :(
It's the same behavior, the warnings come from calling $tcpdf->GetStringWidth().

The image deletion problem is also still present, same as before, when using a custom font-family.

Edit: I just noticed that the image deletion now happens always, and not just with custom font-family, so it's worse than before :/

@nicolaasuni
Copy link
Member

I have just pushed the 6.3.4 version that should solve the image issue.
I can accept a PR for the warnings but I am not actively working this as I would like to concentrate on tc-lib-pdf instead.

@rieschl
Copy link
Author

rieschl commented Feb 12, 2020

Thanks! I removed the GetStringWidth calls for now. Maybe I'll look into it some time.

@arwinvdv
Copy link

I had the same error Warning: array_map(): Expected parameter 2 to be an array, bool given in with upgrading to PHP v7.4.
TCPDF version 6.3.5.
I replaced $tcpdf->GetStringWidth(utf8_decode('textWithSpeçïálCharacters')) to $tcpdf->GetStringWidth('textWithSpeçïálCharacters') and now it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants