Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Notice: ob_flush(): failed to flush buffer. No buffer to flush in drupal_page_footer() (line 2562 of includes\common.inc)
This notice never appears on-screen, only in the logs:
Type php
Date Thursday, May 19, 2011 - 19:30
User admin
Location http://drupal.test/sites/default/files/styles/medium/public/
Referrer http://drupal.test/
Message Notice: ob_flush(): failed to flush buffer. No buffer to flush in drupal_page_footer() (line 2562 of includes\common.inc).
Severity notice
Potentially related issues:
#732542: system_goto_action breaks core APIs
#772274: drupal_send_headers
However, none of them seems to be about this particular error.
Comments
Comment #1
sunJust discovered that above mentioned notice always and consistently appears after this 404:
Comment #2
davisbenI was experiencing this as well. The cause was an empty, but required, image field on my content type. When the image field was added it wasn't required and content was created with no image. After changing it to be required, I was getting these errors in the log when using the update options at admin/content.
Comment #3
davisbenActually, the image field didn't exist on the content type at first, but was added as a required field after some content had been created. Not sure if it makes any difference.
Comment #12
longwavedrupal_page_footer() no longer exists and we don't even call ob_flush() anywhere in core now. Closing as outdated.
Comment #13
Graham Leach CreditAttribution: Graham Leach commentedHello Everyone,
if you run
$php index.php
in your Drupal 7 root, you will probably still get this. I do:
</html>[notice] [php] [127.0.0.1] [uid:0] [http:///index.php?index.php] [] Notice: ob_flush(): failed to flush buffer. No buffer to flush in drupal_page_footer() (line 2821 of /var/www/dev.holisticpethelp.com/mobile/includes/common.inc).
So it's still around, and Drupal 7 is still officially supported for another 9 months.....soooooooo.......
The offending line is in the drupal_page_footer() function:
The issue seems to be that the code assumes that there will always be something to do with ob_flush(), when that isn't (maybe) always the case.
ob_flush() is a PHP native function that basically tells PHP to clear (or "flush") the Output Buffer.
Handily, there is a function to test to see if there is something in the Output Buffer: ob_get_contents()
If ob_get_contents returns FALSE then ob_flush() shouldn't be called.
So, here's the fix:
else {
ob_flush();
}
Becomes
else {
if (!ob_get_contents) ob_flush();
}
g.