I have the following warnings when using FAPE, Panels IPE, and Organic Groups. (I'm integrating OG into Panopoly.)

The warnings occur when og_field_access($op, $field, ...) tries to access $field['field_name'] for $field= 'group_group'.

    Warning: Illegal string offset 'field_name' in og_field_access() (line 592 of /sites/all/modules/og/og.module).
    Warning: Illegal string offset 'field_name' in og_ui_field_access() (line 773 of /sites/all/modules/og/og_ui/og_ui.module).
    Warning: Illegal string offset 'field_name' in og_field_access() (line 592 of /sites/all/modules/og/og.module).
    Warning: Illegal string offset 'field_name' in og_ui_field_access() (line 773 of /sites/all/modules/og/og_ui/og_ui.module).

FAPE is passing $field_name instead of a full field structure array to field_access() [inside of fape_panels_pane_content_alter] which then cascades down to og_field_access().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ericras’s picture

Status: Active » Needs review
FileSize
764 bytes
Pancho’s picture

FileSize
2.66 KB

I can confirm the bug, and the patch #1 fixes it.
I just refactored the code a bit, so it is less redundant and more readable, so either of the two should be fine. But please do some testing!

Pancho’s picture

FileSize
3.04 KB

Same bug in fape_field_edit_page(), leading to some more of the same warnings:

    Warning: Illegal string offset 'field_name' in og_field_access() (line 594 of /sites/all/modules/contrib/og/og.module).
    Warning: Illegal string offset 'field_name' in og_ui_field_access() (line 792 of /sites/all/modules/contrib/og/og_ui/og_ui.module).

Enclosed patch should fix both bugs, but please do some thorough tests.

kclarkson’s picture

I am confirming that the patch applied cleanly and has fixed the error message.

Pancho’s picture

FileSize
3.07 KB

The same patch, but a bit simplified. We don't really need the helper function I added in #2.
From what my tests say, it works fine.

Hydra’s picture

This should proabably be updated to the newest version of Pancho's patch. Still needs review, works for me.

mpotter’s picture

Status: Needs review » Reviewed & tested by the community

Using this (#5) in Open Atrium 2 without any problem.

das-peter’s picture

Patch from #5 looks good and I can confirm that it solves the problem.

saltednut’s picture

We're using #5 in Demo Framework. RTBC++

mrfelton’s picture

Now using #5 in the Panopoly distribution too.

saltednut’s picture

Issue summary: View changes
saltednut’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
76.25 KB

I believe there may still be something going on here. I am seeing errors in the logs but not on every page. Can anyone confirm?
Error appears to have been environmentally specific. Sorry about that.

saltednut’s picture

Status: Needs work » Reviewed & tested by the community
saltednut’s picture

drupalycious’s picture

I confirm that patch#5 fixed the following errors:

Illegal string offset 'field_name' in og_ui_field_access() (line 823 of /.../sites/all/modules/og/og_ui/og_ui.module).
Illegal string offset 'field_name' in og_field_access() (line 588 of /.../sites/all/modules/og/og.module).

Will it be committed?

nlambert’s picture

#5 works for me

DamienMcKenna’s picture

FileSize
3.19 KB

Thanks for the patch, I'm committing it after making a minuscule tweak or three.

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed

  • Commit da0007a on 7.x-1.x by DamienMcKenna:
    Issue #1846156 by Pancho, ericras: Incorrect usage of field_access().
    
saltednut’s picture

w000t!

DamienMcKenna’s picture

Status: Fixed » Closed (fixed)

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

cmonnow’s picture

Just some trivia...this bug only reared its head when I upgraded from PHP 5.3 to PHP 5.5.