Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am getting this error:
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7562 of /includes/common.inc).
I'm stuck debugging this. All I have is:
- The nodes this is about have several taxonomy terms.
- At the spot where the exception is thrown, some taxonomy fields only contain one element: the tid. Others contain more elements including the object "taxonomy_term".
- The reason why the exception is thrown is, that in taxonomy.module::taxonomy_field_formatter_view() the $term passed to entity_uri() (and then to entity_extract_ids() is
$term = $item['taxonomy_term'];
, which for some fields does not exisit (as mentioned above). - Maybe it's helpful to know that I'm coming from d6 with this site.
I'd be really grateful for every hint. I can't find why some taxonomy fields are not populated.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1736466.taxonomy_term_bundle_name.patch | 466 bytes | rszrama |
Comments
Comment #1
rmfleet CreditAttribution: rmfleet commentedI have received this same error code on the same line while displaying a specific content type in a view as a blog roll.
I changed the pager output from 'full' to 'mini' and the error disappeared. If pager items per page is larger than the number of nodes to be displayed, the error does not occur when using the full pager. I am using 7.16.
Comment #2
GiorgosKtry drupal 7 patch in #19 #1161708: Problem with function _field_invoke when used on a content type with no field instance
otherwise try this view issue #1461536: Fatal error when using aggregation and a field is not attached to all entities in the view
Comment #3
rszrama CreditAttribution: rszrama commentedI believe this is a result of a bug I discovered in the entity info for taxonomy terms. The entity keys array uses the correct bundle key name for taxonomy terms (vocabulary_machine_name), but the bundle keys array that's used by a couple API functions like this uses a wrong name (machine_name). Attached patch updates these to match and fixes my issue - and I'm guessing yours.
Comment #5
wgsimon CreditAttribution: wgsimon commentedI had a similar problem when calling field_extract_bundle() on a taxonomy_term entity type. The patch seems to have solved the problem.
Comment #6
wgsimon CreditAttribution: wgsimon commentedJust noticed that this breaks the call to field_extract_bundle( ) in field_ui_field_overview_form( ) in field_ui.admin.inc.
Comment #7
wodenx CreditAttribution: wodenx commentedI can confirm that the patch in #3 is definitely incorrect. See #2024813: hook_entity_info_alter on taxonomy_term "bundle keys" breaks "Manage Fields"
Comment #8
FranciscoLuz CreditAttribution: FranciscoLuz commented#6 seems to be right. I also had the same issue, that is, the taxonomy field ui breaks due to the following piece of code.
Comment #9
lachezar.valchev CreditAttribution: lachezar.valchev at FFW commentedHi,
Agreed with wodenx the difference between the
and
is intentional as described in #2024813: hook_entity_info_alter on taxonomy_term "bundle keys" breaks "Manage Fields"
Regards,
Lachezar