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

PHP 8.2 not working #68

Open
RigidCollision opened this issue Apr 20, 2023 · 6 comments
Open

PHP 8.2 not working #68

RigidCollision opened this issue Apr 20, 2023 · 6 comments

Comments

@RigidCollision
Copy link

I am running back to back PHP8.0 and PHP8.2 and am getting the following in PHP8.2:

PHP Deprecated: Optional parameter $isunicode declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 1999
PHP Deprecated: Optional parameter $isunicode declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2021
PHP Deprecated: Optional parameter $setbom declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2037
PHP Deprecated: Optional parameter $isunicode declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2037
PHP Deprecated: Optional parameter $setbom declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2057
PHP Deprecated: Optional parameter $forcertl declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2057
PHP Deprecated: Optional parameter $isunicode declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2057
PHP Deprecated: Optional parameter $str declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2074
PHP Deprecated: Optional parameter $setbom declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2074
PHP Deprecated: Optional parameter $forcertl declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2074
PHP Deprecated: Optional parameter $isunicode declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2074
PHP Deprecated: Optional parameter $str declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2090
PHP Deprecated: Optional parameter $forcertl declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2090
PHP Deprecated: Optional parameter $isunicode declared before required parameter $currentfont is implicitly treated as a required parameter in PDFMerger\tcpdf\include\tcpdf_fonts.php on line 2090
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::AddPage"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 323
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::AddPage"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 323
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::AddPage"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 323
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::Link"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 338
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278
PHP Deprecated: Callables of the form ["TCPDI", "TCPDF::SetFont"] are deprecated in PDFMerger\tcpdf\fpdf_tpl.php on line 278

@RigidCollision
Copy link
Author

Got the following email communication from Epic2022:

The deprecated functions mentioned in the warnings are related to the TCPDF library, which is used for generating PDF files.
The library has functions with optional parameters that are declared before the required parameters, which is not a good practice.
You should update your code to use the latest version of TCPDF or update the deprecated function calls. If you can't update the library or code, you can suppress the warnings by modifying your php.ini file or adding the following line of code to the top of your PHP file:
error_reporting(E_ALL ^ E_DEPRECATED);
This will turn off the deprecation warnings for the code that you are running. However, this is not recommended as the code may become unusable in future versions of PHP.
It's always a good practice to update your code and libraries to their latest versions to avoid such issues.

I will be taking a look at this and when I have a solution will be posting.

@a4992214
Copy link

a4992214 commented Oct 6, 2023

I am also stuck waiting on this issue

@aydos-t
Copy link

aydos-t commented Feb 20, 2024

for ex.
$unicode = self::UTF8StringToArray($str, $isunicode, $currentfont); //don't work
Here you have to change the place of the variables:
$unicode = self::UTF8StringToArray($str, $currentfont, $isunicode); //workable way
or the variable $currentfont should write first:
$unicode = self::UTF8StringToArray($currentfont, $str, $isunicode); //workable way

@johnloydlao
Copy link

same problem.. anyone solved this issue ?

@johnloydlao
Copy link

same problem.. anyone solved this issue ?

https://github.com/sinanbekar/pdf-merger
this works for me

@RigidCollision
Copy link
Author

RigidCollision commented Mar 8, 2024

In the end what I have done is get the latest FPDI and FPDF libraries and just re-work the original PHPMerger library to use them. Literally two lines need modifying that are specific to TCPDF (you remove the two lines specifically calling the TCPDF header and footer initialisation).

It works with PHPv8.3.3 and if you buy the official FPDI-Parser will handle pretty much everything. Even without the additional commercial parser it is as robust as the original.

This is pretty much what @johnloydlao has mentioned in the link above. When I drilled into what it was doing the code is really simple.

I am using:
FPDF v1.86
FPDI v2.6.0
FPDI-Parser v2.1.2 (not required but for (€100 probably worth it for robustness in a commercial environment).

There looks to be a new version of TCPDF under development which will handle some of the major changes brought about by PHPv8+. Information can be found here (https://tcpdf.org/ )but the link to the new version is: https://github.com/tecnickcom/tc-lib-pdf
A new TCPDF will remove the need for the additional FPDI-Parser (I believe) for dealing with PDF's version 1.4 and above.

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

4 participants