This issue might be either similar to or caused by the discussion in http://drupal.org/node/577590, but if a multigroup is not required, and none of the fields in the group are required, it throws watchdog errors when creating or editing a content type that has multigroup fields in it. I traced the problem to the two functions that deal with the requirement issues listed in the node in the link above.

content_multigroup_node_form_pre_render(&$form) and _content_multigroup_node_form_after_build($form, &$form_state)

In both these function it loops through the forms elements that are multigroups, then it grabs the array keys for the field names, and the array isn't empty it performs the fix for validation. However since the conditional checks if $required_fields is populated after the line $required_fields = array_keys($form['#multigroup_required_fields'][$group_name]); it throws a watchdog error because it passes NULL to array_keys() if there are no required fields. I feel the conditional should check if $form['#multigroup_required_fields'][$group_name] is populated and then get the array keys.

The error doesn't cause any functional issues since nothing has to happen if the fields aren't required, but it fills up the logs pretty quickly when creating a lot of nodes with multigroups. I have created a patch which makes this change. When I make the change the error goes away. I also tested it with required fields to make sure the functions work as expected and it seems to work without any issues.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chriscohen’s picture

Priority: Normal » Major
Status: Active » Needs review
FileSize
1.59 KB

This is a big issue, and is not a duplicate of #577590: Multigroup 'Required' status confusion.

I can't understand why this has been around for almost 6 months and nobody has done anything about it! I came across the problem, found this issue, applied the patch, it worked fine, and surely the stuff it changes is quite obviously wrong to begin with anyway?

I've submitted a slightly different patch as the one above does not respect coding standards, but why can't we apply this and get it sorted?

kmoll’s picture

I agree, is anyone able to look at this and get it committed?

justingeeslin’s picture

This seems to still be an issue in the latest alpha. Easy enough just to make at least one of my fields or groups required. Patch listed above might work..