Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.345
diff -u -p -r1.345 search.module
--- modules/search/search.module	24 Apr 2010 14:49:14 -0000	1.345
+++ modules/search/search.module	27 Apr 2010 06:08:03 -0000
@@ -954,6 +954,16 @@ function search_box_form_submit($form, &
     unset($_GET['destination']);
   }
 
+  // Check to see if the form was submitted empty.
+  // If it is empty, display an error message.
+  // (This method is used instead of setting #required to TRUE for this field 
+  // because that results in a confusing error message.  It would say a plain
+  // "field is required" because the search keywords field has no title.
+  // The error message would also complain about a missing #title field.)
+  if ($form_state['values']['search_block_form'] == '') {
+    form_set_error('keys', t('Please enter some keywords.'));
+  }
+
   $form_id = $form['form_id']['#value'];
   $form_state['redirect'] = 'search/node/' . trim($form_state['values'][$form_id]);
 }
Index: modules/search/search.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.test,v
retrieving revision 1.60
diff -u -p -r1.60 search.test
--- modules/search/search.test	26 Apr 2010 14:26:46 -0000	1.60
+++ modules/search/search.test	27 Apr 2010 06:08:03 -0000
@@ -508,6 +508,27 @@ class SearchBlockTestCase extends Drupal
     $this->drupalPost('admin/structure/block/manage/search/form/configure', $edit, t('Save block'));
     $this->drupalPost('node', $terms, t('Search'));
     $this->assertText('Your search yielded no results');
+
+    // Confirm that the user is redirected to the search page.
+    // $this->assertEqual($this->getUrl(), $this->getAbsoluteUrl('search/node/' . $terms['search_block_form']));
+    $this->assertEqual(
+      $this->getUrl(),
+      url('search/node/' . $terms['search_block_form'], array('absolute' => TRUE)),
+      t('Redirected to correct url.')
+    );
+
+    // Test an empty search via the block form, from the front page.
+    $terms = array('search_block_form' => '');
+    $this->drupalPost('node', $terms, t('Search'));
+    $this->assertText('Please enter some keywords');
+
+    // Confirm that the user is redirected to the search page, when form is submitted empty.
+    // $this->assertEqual($this->getUrl(), $this->getAbsoluteUrl('search/node/'));
+    $this->assertEqual(
+      $this->getUrl(),
+      url('search/node/', array('absolute' => TRUE)),
+      t('Redirected to correct url.')
+    );
   }
 }
 
