diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module
index b4e5b9b..a6599eb 100644
--- a/core/modules/entity/entity.module
+++ b/core/modules/entity/entity.module
@@ -177,17 +177,16 @@ function entity_extract_ids($entity_type, $entity) {
  *   An entity object, initialized with the IDs provided.
  */
 function entity_create_stub_entity($entity_type, $ids) {
-  $values = array();
+  $entity = new stdClass();
   $info = entity_get_info($entity_type);
-  $values[$info['entity keys']['id']] = $ids[0];
+  $entity->{$info['entity keys']['id']} = $ids[0];
   if (!empty($info['entity keys']['revision']) && isset($ids[1])) {
-    $values[$info['entity keys']['revision']] = $ids[1];
+    $entity->{$info['entity keys']['revision']} = $ids[1];
   }
   if (!empty($info['entity keys']['bundle']) && isset($ids[2])) {
-    $values[$info['entity keys']['bundle']] = $ids[2];
+    $entity->{$info['entity keys']['bundle']} = $ids[2];
   }
-  // @todo Once all entities are converted, just rely on entity_create().
-  return isset($info['entity class']) ? entity_create($entity_type, $values) : (object) $values;
+  return $entity;
 }
 
 /**
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 024f3ed..c05cd0f 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -1659,3 +1659,35 @@ function taxonomy_taxonomy_term_delete(TaxonomyTerm $term) {
 /**
  * @} End of "defgroup taxonomy_index"
  */
+
+/**
+ * Implements hook_entity_query_alter().
+ *
+ * Convert EntityFieldQuerys on taxonomy terms that have an entity condition
+ * on term bundles (vocabulary machine names). Since the vocabulary machine
+ * name is not present in the {taxonomy_term_data} table itself, we have to
+ * convert the bundle condition into a proprety condition of vocabulary IDs to
+ * match against {taxonomy_term_data}.vid.
+ */
+function taxonomy_entity_query_alter($query) {
+  $conditions = &$query->entityConditions;
+
+  // Alter only taxonomy term queries with bundle conditions.
+  if (isset($conditions['entity_type']) && $conditions['entity_type']['value'] == 'taxonomy_term' && isset($conditions['bundle'])) {
+    // Convert vocabulary machine names to vocabulary IDs.
+    $vocabulary_data = taxonomy_vocabulary_get_names();
+    $vids = array();
+    if (is_array($conditions['bundle']['value'])) {
+      foreach ($conditions['bundle']['value'] as $vocabulary_machine_name) {
+        $vids[] = $vocabulary_data[$vocabulary_machine_name]->vid;
+      }
+    }
+    else {
+      $vocabulary_machine_name = $conditions['bundle']['value'];
+      $vids = $vocabulary_data[$vocabulary_machine_name]->vid;
+    }
+
+    $query->propertyCondition('vid', $vids, $conditions['bundle']['operator']);
+    unset($conditions['bundle']);
+  }
+}
diff --git a/core/modules/taxonomy/taxonomy.test b/core/modules/taxonomy/taxonomy.test
index 5c16884..8631d44 100644
--- a/core/modules/taxonomy/taxonomy.test
+++ b/core/modules/taxonomy/taxonomy.test
@@ -1913,3 +1913,56 @@ class TaxonomyThemeTestCase extends TaxonomyWebTestCase {
   }
 
 }
+
+/**
+ * Tests the functionality of EntityFieldQuery for taxonomy entities.
+ */
+class TaxonomyEFQTestCase extends TaxonomyWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Taxonomy EntityFieldQuery',
+      'description' => 'Verifies operation of a taxonomy-based EntityFieldQuery.',
+      'group' => 'Taxonomy',
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+    $this->admin_user = $this->drupalCreateUser(array('administer taxonomy'));
+    $this->drupalLogin($this->admin_user);
+    $this->vocabulary = $this->createVocabulary();
+  }
+
+  /**
+   * Tests that a basic taxonomy EntityFieldQuery works.
+   */
+  function testTaxonomyEFQ() {
+    $terms = array();
+    for ($i = 0; $i < 5; $i++) {
+      $term = $this->createTerm($this->vocabulary);
+      $terms[$term->tid] = $term;
+    }
+    $query = new EntityFieldQuery();
+    $query->entityCondition('entity_type', 'taxonomy_term');
+    $result = $query->execute();
+    $result = $result['taxonomy_term'];
+    asort($result);
+    $this->assertEqual(array_keys($terms), array_keys($result), 'Taxonomy terms were retrieved by EntityFieldQuery.');
+
+    // Create a second vocabulary and five more terms.
+    $vocabulary2 = $this->createVocabulary();
+    $terms2 = array();
+    for ($i = 0; $i < 5; $i++) {
+      $term = $this->createTerm($vocabulary2);
+      $terms2[$term->tid] = $term;
+    }
+
+    $query = new EntityFieldQuery();
+    $query->entityCondition('entity_type', 'taxonomy_term');
+    $query->entityCondition('bundle', $vocabulary2->machine_name);
+    $result = $query->execute();
+    $result = $result['taxonomy_term'];
+    asort($result);
+    $this->assertEqual(array_keys($terms2), array_keys($result), format_string('Taxonomy terms from the %name vocabulary were retrieved by EntityFieldQuery.', array('%name' => $vocabulary2->name)));
+  }
+}
