Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.589
diff -u -p -r1.589 theme.inc
--- includes/theme.inc	13 Apr 2010 15:23:02 -0000	1.589
+++ includes/theme.inc	22 Apr 2010 20:10:50 -0000
@@ -1680,7 +1680,16 @@ function theme_table($variables) {
 
   // Add the 'empty' row message if available.
   if (!count($rows) && $empty) {
-    $rows[] = array(array('data' => $empty, 'colspan' => count($header), 'class' => array('empty', 'message')));
+    $header_count = 0;
+    foreach ($header as $header_cell) {
+      if (is_array($header_cell)) {
+        $header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1;
+      }
+      else {
+        $header_count++;
+      }
+    }
+    $rows[] = array(array('data' => $empty, 'colspan' => $header_count, 'class' => array('empty', 'message')));
   }
 
   // Format the table header:
Index: modules/simpletest/tests/theme.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/theme.test,v
retrieving revision 1.14
diff -u -p -r1.14 theme.test
--- modules/simpletest/tests/theme.test	21 Mar 2010 04:05:24 -0000	1.14
+++ modules/simpletest/tests/theme.test	22 Apr 2010 20:10:50 -0000
@@ -110,15 +110,22 @@ class ThemeTableUnitTest extends DrupalW
   }
 
   /**
-   * Tests that the table header is printed even if there are no rows. And that
-   * the empty text is displayed correctly.
+   * Tests that the table header is printed correctly even if there are no rows,
+   * and that the empty text is displayed correctly.
    */
   function testThemeTableWithEmptyMessage() {
-    $header = array(t('Header 1'), t('Header 2'));
+    $header = array(
+      t('Header 1'), 
+      array(
+        'data' => t('Header 2'),
+        'colspan' => 2,
+      ),
+    );
     $this->content = theme('table', array('header' => $header, 'rows' => array(), 'empty' => t('No strings available.')));
-    $this->assertRaw('<tr class="odd"><td colspan="2" class="empty message">No strings available.</td>', t('Correct colspan was set on empty message.'));
+    $this->assertRaw('<tr class="odd"><td colspan="3" class="empty message">No strings available.</td>', t('Correct colspan was set on empty message.'));
     $this->assertRaw('<thead><tr><th>Header 1</th>', t('Table header was printed.'));
   }
+
 }
 
 /**
