I get the following notice:
Notice: Trying to get property of non-object in taxonomy_entity_query_alter() (line 2053 of /[..]/modules/taxonomy/taxonomy.module).
Digging deeper, I found this in taxonomy_feeds_set_target():
if (!isset($cache['allowed_vocabularies'][$target])) {
foreach ($info['settings']['allowed_values'] as $tree) {
if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
$cache['allowed_vocabularies'][$target][$vocabulary->vid] = $vocabulary->machine_name;
}
}
}
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'taxonomy_term')
->entityCondition('bundle', $cache['allowed_vocabularies'][$target])
->range(0, 1);
Problem: The above code intends to guarantee that $cache['allowed_vocabularies'][$target]
will not be empty.
But this will fail if $info['settings']['allowed_values']
is empty, or if a vocabulary with the machine name from $tree['vocabulary'] does not exist.
This probably means that field settings point to a deleted or non-existing vocabulary. Typical deployment fails.
Either way, taxonomy_feeds_set_target() should properly initialize $cache['allowed_vocabularies'][$target]
, before going into the foreach() loop.
Comment | File | Size | Author |
---|---|---|---|
#4 | feeds-7.x-2.x-2489006-4-taxonomy_feeds_set_target.patch | 735 bytes | donquixote |
Comments
Comment #1
donquixote CreditAttribution: donquixote commentedHm, I notice that empty arrays in conditions are no good either.
The function should have a special behavior for this case..
Comment #2
donquixote CreditAttribution: donquixote commentedThe following seems to work. Not sure if that is a good solution.
Comment #3
MegaChriz CreditAttribution: MegaChriz commentedIs this the same issue as #2147341: Missing bundle property on entity of type taxonomy_term when replacing existing terms? If not, it is at least related.
Comment #4
donquixote CreditAttribution: donquixote commentedProbably related or the same symptom, yes.
I am going to post my patch here, just because this issue describes the underlying problem that this particular patch is going to fix, instead of focusing on the symptom.
I can re-post the patch in the other issue if that is desired.
Comment #7
twistor CreditAttribution: twistor commentedOpps. Forgot the test.