My site, which has migration as an import component, was starting to throw server errors when trying to view a taxonomy term page. I was able to trace this back to metatag module and the fact the term ID actually no longer existed (the migration creating it had been rolled back and reran, thus causing the tid to no longer be valid.

When metatag module loads the taxonomy term for the current taxonomy overview page it does not check if the lookup actually had a result and passes a potential NULL value into the Drupal API. This will eventually result in an EntityMalformedException: Missing bundle property on entity of type taxonomy_term. I will attach a patch in a minute.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eelkeblok’s picture

Title: May try to load entities that no longer exists » May try to load entities that no longer exist
FileSize
771 bytes

Here's the patch I quickly rolled. You may test this issue by visiting taxonomy/term/ (before the patch this will cause an internal server error, after the patch you should see however the view is configured to handle incorrect arguments). You will need to enable the Views overridden version of the taxonomy overview, that's what this code is dealing with.

Simon Georges’s picture

Status: Active » Needs review
DamienMcKenna’s picture

Issue summary: View changes
FileSize
1.43 KB

Rerolled, and duplicated for metatag_ctools_render_alter() too.

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ipo4ka704’s picture

Status: Closed (fixed) » Needs review
FileSize
797 bytes

When metatag module loads the taxonomy term for the current taxonomy overview page it does not check if the lookup a result is object and passes a potential string value into the "metatag_entity_view" function, when you go to /taxonomy/term/%/%. This will eventually result in an EntityMalformedException: Missing bundle property on entity of type taxonomy_term. I attach a patch.

Status: Needs review » Needs work

The last submitted patch, 6: metatag-entity-malformed-2071649-6.patch, failed testing.

eelkeblok’s picture

Status: Needs work » Closed (fixed)

Hi. Thanks for the patch! However, you shouldn't reopen issues that have reached the "Closed (fixed)" status, see https://www.drupal.org/node/156119. This makes a certain amount of sense; the issue has been worked all the way to completion (patch provided, rtbc, reviewed, committed, fixed, marked by bot as "Closed (fixed)"), so any problems found afterwards are essentially new problems. It would be great if you could create a new issue issue and attach your patch to it. You can of course refer to this issue stating it is a follow-up.