? boost-385924.patch
Index: boost.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v
retrieving revision 1.3.2.2.2.5.2.43
diff -u -p -r1.3.2.2.2.5.2.43 boost.module
--- boost.module	2 Jun 2009 20:08:47 -0000	1.3.2.2.2.5.2.43
+++ boost.module	3 Jun 2009 21:57:16 -0000
@@ -56,6 +56,8 @@ function boost_help($path, $arg) {
     case 'admin/settings/performance/boost':
       return '<p>' . t('') . '</p>'; // TODO: add help text.
   }
+  //hack to get drupal_get_messages before they are destroyed.
+  $GLOBALS['_boost_message_count'] = count(drupal_get_messages(NULL, FALSE));
 }
 
 /**
@@ -315,6 +317,22 @@ function boost_block($op = 'list', $delt
                 'The cached copy will expire in %interval.',
                 array('%interval' => format_interval(abs($ttl))));
             }
+            $error = FALSE;
+            if (function_exists('error_get_last')) {
+              $error = error_get_last();
+            }
+            $drupal_msg = max(count(drupal_get_messages(NULL, FALSE)),$GLOBALS['_boost_message_count']);
+
+            if ($error || $drupal_msg != 0) {
+              $ttl = boost_file_get_ttl(boost_file_path($GLOBALS['_boost_path']));
+              $output = t('There are <strong>php errors</strong> or <strong>drupal messages</strong> on this page, preventing boost from caching.');
+              if ($error){
+                $output .= ' ERRORS:' . $error['type'];
+              }
+              if ($drupal_msg != 0) {
+                $output .= ' MESSAGES:' . $drupal_msg;
+              }
+            }
 
             $block['subject'] = '';
             $block['content'] = theme('boost_cache_status', isset($ttl) ? $ttl : -1, $output);
@@ -370,7 +388,7 @@ function _boost_ob_handler($buffer) {
   // were output with a 200 OK status. Anything more is simply asking for
   // loads of trouble.
   if (   _boost_get_http_status() == 200 
-      && count(drupal_get_messages(NULL, FALSE)) == 0 
+      && $GLOBALS['_boost_message_count'] == 0
       && strlen($buffer) > 0
       ) {
     if (_boost_get_content_type() == 'text/html') {
