Closed neerajrajendran closed 3 years ago
Unable to reproduce. Provide example code that actually reproduces this issue.
Make sure your mPDF version is >= v8.0.4, PHP 7.4 is not supported before that.
Is there any alternate way of putting page number on SetHTMLFooter method, instead of using {PAGENO}
If you found an notice/warning/error in mPDF, help reproduce it and fix it. If you have a general question/troubleshooting, adhere to contribution guidelines.
my mPDF version is 8.0.11 still its not working!
Unable to reproduce. Provide example code that actually reproduces this issue.
<?php
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->SetHTMLFooter('<div class="footer"> page: {PAGENO}/{nb}</div>');
$mpdf->WriteHTML('<h1 class="header">Page Title</h1>');
$mpdf->Output();
No, still works correctly.
This doesn't works with php 7.4.22. other versions this works fine.
No, I just generated the PDF with your code with PHP 7.4.22. Repeating "doesn't works" is not helpful, provide more information. You can start with the stack trace of the error.
I think it is dropped in some upper version or something. Today I hit this snag and couldn't believe to find this:
$this->bodyBackgroundColor{0} == 5
Never knew even that it was part of the language
I Fixed the error until it generated the PDF. do not have time to sort things and make PR. Whoever can ATM, here is the zip of src MPDF-src.zip
since PHP 7.4 curly braces method for accessing array elements has been deprecated, so change the bellow syntax :
$this->bodyBackgroundColor{0}
into to this:
$this->bodyBackgroundColor[0]
https://wiki.php.net/rfc/deprecate_curly_braces_array_access
The problem is simple: PHP 8.0 and further do not accept curly braces to access array and strings: it's been deprecated.
So, either switch a former version of PHP Or, search and replace all arrays and strings accessed with curly braces
I found this bug
While using {PAGENO} and {nb} , I am getting this error "Array and string offset access syntax with curly braces is deprecated"
This is mPDF and PHP version and environment (server/fpm/cli etc) I am using
mPDF = 8.0^ PHP version = 7.4.22 server = linux
This is the PHP code snippet I use
How do I solve this without changing the PHP version.
Thank you