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.
To reproduce this issue, please install 7.x-1.10 or 7.x-1.x-dev version of i18n module on a clean Drupal 7 website, generate some content (nodes, taxonomy fields), enable couple, three languages, activate Taxonomy translation module and go to Edit tab of any node to get:
Notice: Undefined property: stdClass::$vid in i18n_taxonomy_term_name() (line 461 of /home/website/public_html/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 173 of /home/website/public_html/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 350 of /home/website/public_html/includes/entity.inc).
Notice: Undefined property: stdClass::$vid in i18n_taxonomy_term_name() (line 461 of /home/website/public_html/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).
I know there were some similar discussions, for example on https://drupal.org/node/1802468, but (1) I tried all the patches with no joy and (2) they in that page never mentioned about Taxonomy translation module involved. And it is obviously about Taxonomy translation because the error goes away if I turn off this module.
Comments
Comment #1
cmunk CreditAttribution: cmunk commentedI have the same error on the regular version of i18. Did you find a fix?
Comment #2
adiatisSame problem here. Is there any fix available?
Comment #3
aaagepard CreditAttribution: aaagepard commentedThe same. Any news?
Comment #4
cpelham CreditAttribution: cpelham commentedI just installed and added a node and am getting a similar error:
Notice: Trying to get property of non-object in i18n_taxonomy_term_name() (line 461 of /customers/b/5/c/mysite.com/httpd.www/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).
Comment #5
yngens2 CreditAttribution: yngens2 commentedUnfortunately, no solution yet.
Comment #6
rodrigoaguileraI runned into this while doing a term migration. I ended up disabling hook_taxonomy_term_presave inside i18n_taxonomy during the migration.
Comment #7
darkothenew CreditAttribution: darkothenew commentedI find solution for this issue. It is an issue with Taxonomy Term Reference Tree Widget and i18 module where function in i18 need $term->vid property not provided by function in Term Reference Tree.
function i18n_taxonomy_term_name($term, $langcode = NULL)
on line 461 need vid:
return i18n_taxonomy_vocabulary_mode($term->vid....
Go to term_reference_tree.module and on line 142 do next:
$query->fields('t', array('tid', 'name'));
change to:
$query->fields('t', array('tid', 'vid', 'name'));
The function is called indirectly, with no provided vid, and it cause many PHP notice (one by every used term).
If this fix cause some functionality issue maybe you need to apply this PATCH.
Hope this will help you.
Comment #8
josecarlos1977 CreditAttribution: josecarlos1977 commentedGracias darkothenew. Me funcionó perfecto.
Comment #9
pinueve CreditAttribution: pinueve commented+1 to #7, works perfect
Comment #10
Christophe Bourgois CreditAttribution: Christophe Bourgois commented+1 to #7, works perfect
Comment #11
mariano.barcia CreditAttribution: mariano.barcia as a volunteer commented#7 fixes this annoying problem. Thank you @darkothenew!
Comment #12
mariano.barcia CreditAttribution: mariano.barcia as a volunteer commentedComment #13
weri CreditAttribution: weri at Previon Plus AG commentedWhen the "Taxonomy Term Reference Tree Widget" is used, the following issue fixes the problem: #1514794: i18n compatibility
Maybe we can close this issue?
Comment #14
jcnventura CreditAttribution: jcnventura at Wunder commentedThere's no patch here, and it seems the patch applies to the "Taxonomy Term Reference Tree Widget" module anyway.
Comment #15
devad CreditAttribution: devad as a volunteer commentedI suppose we can close this as duplicate of #1514794: i18n compatibility. Patch is available there and tested as RTBC.
Related issue for those using Entity Translation: #2101195: Entity Translation (Title module) compatibility.
If this issue is related to something more than Taxonomy Term Reference Tree Widget issue quoted above, and is actually related to Internationalization module itself... please feel free to reopen.