If there are no fields defined, field_info_fields() causes an E_NOTICE because we are initializing $info['field'] instead of $info['fields'] by accident.

Straight to RTBC!

CommentFileSizeAuthor
#1 field-info-typo-1.patch914 bytesbjaspan
field-info-typo.patch676 bytesbjaspan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bjaspan’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
914 bytes

Okay, so the previous patch was "right" in that it fixed a bug correctly but not entirely complete.

I'm working on Combo Field, and in hook_entity_info() I am calling field_info_fields(). This causes _field_info_collate_*() functions to be called recursively, and there is a code path that allows _field_info_collate_fields() to return an $info structure with no 'fields' element (even after the fix in the previous patch).

I've attached a workaround in which field_info_fields() does not assume that the 'fields' element is defined, but this is probably not the right solution; _field_info_collate_fields() should *always* return a 'fields' element, full stop.

So, no longer RTBC.

yched’s picture

Status: Needs work » Reviewed & tested by the community

Discussed that with Barry. We're not exactly sure yet what is the bug described in comment #1, nor if there's actually a bug.

Let's fix the typo ASAP, we'll probably see clearer after that.
So back to RTBC for the patch in the original post.

Dries’s picture

Status: Reviewed & tested by the community » Needs review

Committed the initial patch, setting back to 'needs review' for the follow-up patch.

Status: Needs review » Needs work

The last submitted patch failed testing.

bjaspan’s picture

Status: Needs work » Closed (duplicate)

The second issue, first mentioned in #1, is better described in #570554: Race conditions / recursion in _field_info_fieldable_types(), so I'm marking this duplicate.