Skip Navigation

[Résolu] functions php on line 4609

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
The user was encountering the following PHP notice on his website:
Notice: ob_end_flush(): failed to send buffer of zlib output compression (0)

Solution:
This is not a Toolset error, but rather, a wordpress edge case with the zlib compression configured on the server.
Check this https://stackoverflow.com/questions/38693992/notice-ob-end-flush-failed-to-send-buffer-of-zlib-output-compression-1-in

The user was able to fix it following this article https://www.kevinleary.net/wordpress-ob_end_flush-error-fix/

By adding the following code to theme's functions.php

/**
* Proper ob_end_flush() for all levels
*
* This replaces the WordPress `wp_ob_end_flush_all()` function
* with a replacement that doesn't cause PHP notices.
*/
remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
add_action( 'shutdown', function() {
while ( @ob_end_flush() );
} );
This support ticket is created Il y a 4 années. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+00:00)

This topic contains 5 réponses, has 2 voix.

Last updated by tony Il y a 4 années.

Assisted by: Jamal.

Auteur
Publications
#1586587

Tell us what you are trying to do?
Viewing a website that wasworking ok but now displaying an error message for users that are not logged in.

Is there any documentation that you are following?
No

Is there a similar example that we can see?

What is the link to your site?
hidden link

If you display the above website - any page the following is displayed at the bottom:

Notice: ob_end_flush(): failed to send buffer of zlib output compression (0) in /home/milfordassociate/teesdalelocal.co.uk/wp-includes/functions.php on line 4609

The relevant part of functions.php is

/**
* Flush all output buffers for PHP 5.2.
*
* Make sure all output buffers are flushed before our singletons are destroyed.
*
* @since 2.2.0
*/
function wp_ob_end_flush_all() {
$levels = ob_get_level();
for ( $i = 0; $i < $levels; $i++ ) {
ob_end_flush();
}
}

If I login to the website, this error message does not appear.

Please can you suggest how this might be fixed?

Thanks
Tony

PS All software and WordPress up to date.

NOT URGENT

#1586611

Jamal
Supporter

Languages: Anglais (English ) Français (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

I don't think it is an issue with Toolset plugins. If you search for this error you will see it is a common WordPress error, which generates when you have zlib output compression enabled. Disable it and it should be solved. For more info, see this thread:
https://stackoverflow.com/questions/38693992/notice-ob-end-flush-failed-to-send-buffer-of-zlib-output-compression-1-in

I hope this helps. I remain at your disposal.

#1586885

Thanks Jamel

I tried the changes suggested but nothing worked. However, now I know it is a WP problem I will see if I can find another solution. It seems odd that my other site works fine though (older version of WP).

Regards
Tony

#1587225

Jamal
Supporter

Languages: Anglais (English ) Français (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Thank you Tony for your feedback.

I'll set the status of this ticket with the status "I think it's resolved", it will remain open for a week. You may also want to mark this one as resolved and open a new ticket when you need more assistance.

Best regards,
Jamal

#1587247

My issue is resolved now. Thank you!

#1587869

For information to others:

hidden link

I put this at the end of my child theme functions.php

/**
* Proper ob_end_flush() for all levels
*
* This replaces the WordPress `wp_ob_end_flush_all()` function
* with a replacement that doesn't cause PHP notices.
*/
remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
add_action( 'shutdown', function() {
while ( @ob_end_flush() );
} );

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.