Really-Simple-Plugins / complianz-gdpr

Complianz Privacy Suite (GDPR/CCPA)
https://complianz.io
Other
91 stars 39 forks source link

PHP warning #384

Closed sviluppomania closed 1 year ago

sviluppomania commented 1 year ago

Hello, I encountered this warning:

Is there a solution to this warning?

Thank you.

Best regards

rlankhorst commented 1 year ago

This is usually caused by another plugin not closing the output buffer. Can you check if the error is gone if the other plugins are deactivated?

sviluppomania commented 1 year ago

Hi @rlankhorst , I have deactivated all plugins but none cause this error. There is a similar error with WordPress: Notice: ob_end_flush(): Failed to send buffer of zlib output compression (1) in /wp-includes/functions.php on line 5279

Also the WordPress error remained by disabling all plugins.

rlankhorst commented 1 year ago

Can you try increasing the memory on your website by adding this to your wp-config.php?

define( 'WP_MEMORY_LIMIT', '256' );

sviluppomania commented 1 year ago

Already done, but the error remains.

rlankhorst commented 1 year ago

Then there might be something specific on your hosting environment, as we haven't been able to reproduce this yet.

I will keep an eye out if I can find an issue like this so I can debug it. Most likely it's something in the server setup.

sviluppomania commented 1 year ago

I noticed other users reported the same problem previously, here: https://wordpress.org/support/topic/problems-ob_end_flush-failed-to-send-buffer-of-zlib-output-compression-0/

Theme: Grace Mag v1.1.3 ( https://it.wordpress.org/themes/grace-mag/ )

Version PHP: 8.1.12

On the site I use the WP Fastest Cache plugin ( https://it.wordpress.org/plugins/wp-fastest-cache/ ) and Gzip is also set.

zlib.output_compression is enabled on the server, I tried disabling it too but the error remains.

rlankhorst commented 1 year ago

That user resolved it by upgrading php, so was caused by something else.

Did you also try switching to a default wp theme?

sviluppomania commented 1 year ago

Yes, I tried to switch to a default WP theme (e.g. the latest plugin: Twenty Twenty-Three ), but the same Front-end error reappears with WP Debug active.

sviluppomania commented 1 year ago

@rlankhorst

Looking for the error, some recommend replacing:

ob_end_flush();

with

remove_action( 'shutdown', 'wp_ob_end_flush_all', 1);

rlankhorst commented 1 year ago

The shutdown hook is too late for our purposes, which also means the error already has occurred when the shutdown hook triggers. So this wouldn't work.

Additionally, if there is a difference between opening buffers and closing buffers, which this code suggests, it is better to fix that than to try closing all buffers with brute force.

It might be that your hosting provider is opening or closing a buffer from Complianz.

sviluppomania commented 1 year ago

Hi @rlankhorst , recently, after the update, these new ones also appeared:

PHP Warning: Undefined array key 2 in /plugins/complianz-gdpr/assets/vendor/mpdf/mpdf/src/Mpdf.php on line 12720 PHP Warning: Undefined array key 2 in /plugins/complianz-gdpr/assets/vendor/mpdf/mpdf/src/Mpdf.php on line 12746

rlankhorst commented 1 year ago

@sviluppomania what php version are you on? This is from the MPDF library, which we use, but don't maintain ourselves.

sviluppomania commented 1 year ago

PHP 8.1.13

rlankhorst commented 1 year ago

The current MPDF version is 8.0.5, full php 8.1 support is as of v8.0.13. I've created a version with v8.0.13 here: https://github.com/Really-Simple-Plugins/complianz-gdpr/tree/mpdf-update

It's a tightrope we walk on, as the 8.1.3 version does not support 7.4 anymore.

We'll run our php support tests, if it is accepted, it will get merged in one of the coming updates.

sviluppomania commented 1 year ago

The current MPDF version is 8.0.5, full php 8.1 support is as of v8.0.13. I've created a version with v8.0.13 here: https://github.com/Really-Simple-Plugins/complianz-gdpr/tree/mpdf-update

It's a tightrope we walk on, as the 8.1.3 version does not support 7.4 anymore.

We'll run our php support tests, if it is accepted, it will get merged in one of the coming updates.

Hi, Will this fix be added to the main branch?

rlankhorst commented 1 year ago

Yes, it will get tested and merged, I expect about 4 weeks until release.

sviluppomania commented 1 year ago

These reappeared:

PHP Warning:  Undefined array key 2 in /plugins/complianz-gdpr/assets/vendor/mpdf/mpdf/src/Mpdf.php on line 12720
PHP Warning:  Undefined array key 2 in /plugins/complianz-gdpr/assets/vendor/mpdf/mpdf/src/Mpdf.php on line 12746
rlankhorst commented 1 year ago

@sviluppomania this branch has not been merged yet, as it is still in the testing fase.

sviluppomania commented 1 year ago

Questi sono riapparsi:

PHP Warning:  Undefined array key 2 in /plugins/complianz-gdpr/assets/vendor/mpdf/mpdf/src/Mpdf.php on line 12720
PHP Warning:  Undefined array key 2 in /plugins/complianz-gdpr/assets/vendor/mpdf/mpdf/src/Mpdf.php on line 12746

Hi @rlankhorst , A few days ago these PHP Warnings appeared, with the branch closed have they been fixed?

Thanks. Best regards,

rlankhorst commented 1 year ago

The mpdf library has now been updated to the highest version that is still compatible with php 7.2. We can't update above that at this point. As these are just warnings you can ignore them.

When support for 7.2 can be dropped we can update again.

sviluppomania commented 1 year ago

There is no compatibility with PHP 8.x.x. ?

rlankhorst commented 1 year ago

See https://github.com/mpdf/mpdf

php 8.2 is supported, but the latest versions do not support 7.2 anymore, so we can't update yet. We have to wait until 7.2 is dropped.