I have an error after updating from 1.8 version to 1.9 version of lexicon.

I have that in my php log error :

[06-May-2012 14:31:32] PHP Fatal error:  Cannot access empty property in /Users/xav/Developpement/www/yogarik/modules/field/field.module on line 972
[06-May-2012 14:31:32] PHP Stack trace:
[06-May-2012 14:31:32] PHP   1. {main}() /Users/xav/Developpement/www/yogarik/index.php:0
[06-May-2012 14:31:32] PHP   2. menu_execute_active_handler($path = *uninitialized*, $deliver = *uninitialized*) /Users/xav/Developpement/www/yogarik/index.php:21
[06-May-2012 14:31:32] PHP   3. call_user_func_array(*uninitialized*, *uninitialized*) /Users/xav/Developpement/www/yogarik/includes/menu.inc:517
[06-May-2012 14:31:32] PHP   4. _lexicon_page($letter = *uninitialized*) /Users/xav/Developpement/www/yogarik/includes/menu.inc:0
[06-May-2012 14:31:32] PHP   5. _lexicon_overview($vocab = *uninitialized*, $letter = *uninitialized*) /Users/xav/Developpement/www/yogarik/sites/all/modules/custom/lexicon/lexicon.pages.inc:52
[06-May-2012 14:31:32] PHP   6. _lexicon_term_add_info($term = *uninitialized*) /Users/xav/Developpement/www/yogarik/sites/all/modules/custom/lexicon/lexicon.pages.inc:143
[06-May-2012 14:31:32] PHP   7. field_get_items($entity_type = *uninitialized*, $entity = *uninitialized*, $field_name = *uninitialized*, $langcode = *uninitialized*) /Users/xav/Developpement/www/yogarik/sites/all/modules/custom/lexicon/lexicon.module:1030

I apply a patch on the lexicon.module to correct this error, it's because the field_get_items expect the third parameters to not be empty (because of the dynamic use in

$entity->{$field_name}[$langcode]

I joined my patch to this post, i don't know if i'm the only one who have this problem... and hope there is no other bug after updating.

CommentFileSizeAuthor
#2 lexicon.module.patch2.47 KBxadag
lexicon.module.patch2.91 KBxadag

Comments

marty2081’s picture

Status: Active » Needs review

Thanks for reporting. I added check to see if the field is configured before calling field_get_items(). The changes are in the dev branch.

xadag’s picture

StatusFileSize
new2.47 KB

I think this is a better patch syntax with diff -ruN

Status: Needs review » Needs work

The last submitted patch, lexicon.module.patch, failed testing.

marty2081’s picture

Please explain why (!empty($somehting)) is better than ($something != ''), knowing that $something is either filled with a field_name or with '', since '' is set as the default value?

pheraph’s picture

I experienced the same error and after updating to the latest -dev the error didn't appear again. Thanks!

JoachimF’s picture

I experienced the same error also - issue went away when I rolled back to 1.8

marty2081’s picture

Status: Needs work » Needs review

@JoachimF: I know that it goes away when you roll back. I would like to know if the fix in the dev version resolves the issue so I can make a new release.

gavmassingham’s picture

I had the same issue and problem is fixed by dev.

marty2081’s picture

Status: Needs review » Fixed

So I conclude that this one is fixed then.

Dave Sandilands’s picture

I agree that the new dev version fixes this issue.

Status: Fixed » Closed (fixed)

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