Index: modules/taxonomy/taxonomy.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v
retrieving revision 1.35
diff -u -p -r1.35 taxonomy.pages.inc
--- modules/taxonomy/taxonomy.pages.inc	24 Aug 2009 00:14:22 -0000	1.35
+++ modules/taxonomy/taxonomy.pages.inc	4 Sep 2009 15:42:01 -0000
@@ -92,6 +92,13 @@ function taxonomy_term_edit($term) {
  * Helper function for autocompletion
  */
 function taxonomy_autocomplete_legacy($vid = 0, $tags_typed = '') {
+  
+  // The user enters only whitespace. Return valid, but with zero matches.
+  if (preg_replace('/\S/', "", $tags_typed) == $tags_typed) {
+    drupal_json(array());
+    exit;
+  }
+
   // The user enters a comma-separated list of tags. We only autocomplete the last tag.
   $tags_typed = drupal_explode_tags($tags_typed);
   $tag_last = drupal_strtolower(array_pop($tags_typed));
@@ -144,6 +151,12 @@ function taxonomy_autocomplete_legacy($v
 function taxonomy_autocomplete($field_name, $bundle, $tags_typed = '') {
   $instance = field_info_instance($field_name, $bundle);
   $field = field_info_field($field_name);
+  
+  // The user enters only whitespace. Return valid, but with zero matches.
+  if (preg_replace('/\S/', "", $tags_typed) == $tags_typed) {
+    drupal_json(array());
+    exit;
+  }
 
   // The user enters a comma-separated list of tags. We only autocomplete the last tag.
   $tags_typed = drupal_explode_tags($tags_typed);
