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.
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!
Comment | File | Size | Author |
---|---|---|---|
#1 | field-info-typo-1.patch | 914 bytes | bjaspan |
field-info-typo.patch | 676 bytes | bjaspan | |
Comments
Comment #1
bjaspan CreditAttribution: bjaspan commentedOkay, 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.
Comment #2
yched CreditAttribution: yched commentedDiscussed 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.
Comment #3
Dries CreditAttribution: Dries commentedCommitted the initial patch, setting back to 'needs review' for the follow-up patch.
Comment #5
bjaspan CreditAttribution: bjaspan commentedThe 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.