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

Returns fatal error with PHP 8.0, user provided fix #93

Open
djw0510 opened this issue Jul 26, 2022 · 4 comments
Open

Returns fatal error with PHP 8.0, user provided fix #93

djw0510 opened this issue Jul 26, 2022 · 4 comments

Comments

@djw0510
Copy link

djw0510 commented Jul 26, 2022

Fatal error: Array and string offset access syntax with curly braces is no longer supported in /wp-content/plugins/dk-pdf/vendor/mpdf/mpdf/src/Mpdf.php on line 2209

User @lusant has provided a fix at https://wordpress.org/support/topic/breaks-with-php-8-0/

Is there any way we can get this incorporated into a new version? I think there's a lot of people who depend on this plugin via dependency management tools who would benefit from the update.

@KZeni
Copy link

KZeni commented Aug 2, 2022

Here's a link to @lusant's patched version just in case they delete the post from the WP.org support forum topic (they don't like it when people link to files in the forum as a security precaution): https://drive.google.com/file/d/1YZA2hipCa11S7uZfhoZu8IlbfKL1cZKA/view?usp=sharing (mirror: https://f.kzeni.com/dk-pdf-1.9.6-patched.zip)
*I can confirm the fatal error goes away with this.

Looks like there's also https://github.com/wwwxkz/dk-pdf which forked this to patch things to add PHP 8.x support as well.

So it seems there are 2 options now, and we just need the official plugin to adopt one & get the WP.org plugin listing to offer it.

@wwwxkz
Copy link

wwwxkz commented Aug 3, 2022

I was going to send a PR but I made changes in the vendor mpdf (not dk-pdf itself), and it does not exist here in github. I could open an PR adding all vendors or maybe try to make it work with the latest mpdf version, but as it is working in my live and serves my purpose I do not think I will have time to do so.

@wwwxkz
Copy link

wwwxkz commented Aug 3, 2022

I made the PR #94 and I kept my old solution updating the mpdf 7.0 https://github.com/wwwxkz/dk-pdf as I created another repo for this PR in https://github.com/wwwxkz/dk-pdf-fork. As said in the PR, although updating mpdf to 8.10 in composer.json works, it requires different PHP versions from dk-pdf, using 7.4 > worked fine for me, but I did not test for all of them.

@Coss0475
Copy link

Coss0475 commented Nov 3, 2023

I have WP 6.3.2 and PHP 8.2.11. I get this error in debug:
Fatal error: Uncaught Mpdf\MpdfException: Data has already been sent to output, unable to output PDF file in /opt/bitnami/wordpress/wp-content/plugins/dk-pdf-main-with-fork/vendor/mpdf/mpdf/src/Mpdf.php:9323 Stack trace: #0 /opt/bitnami/wordpress/wp-content/plugins/dk-pdf-main-with-fork/includes/dkpdf-functions.php(216): Mpdf\Mpdf->Output() #1 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(310): dkpdf_output_pdf() #2 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters() #3 /opt/bitnami/wordpress/wp-includes/plugin.php(565): WP_Hook->do_action() #4 /opt/bitnami/wordpress/wp-includes/class-wp.php(796): do_action_ref_array() #5 /opt/bitnami/wordpress/wp-includes/functions.php(1335): WP->main() #6 /opt/bitnami/wordpress/wp-blog-header.php(16): wp() #7 /opt/bitnami/wordpress/index.php(17): require('...') #8 {main} thrown in /opt/bitnami/wordpress/wp-content/plugins/dk-pdf-main-with-fork/vendor/mpdf/mpdf/src/Mpdf.php on line 9323
Is this related ?
How to get the fixed version for PHP 8?
Thank you

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