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.
On line 244-261 in multiselect module the if clauses are checking for is_array($value['value']). In my case, using taxonomies, the 'value' index is never set so the error log fills up with "Undefined index" notices quite quickly.
if (is_array($value['value']) && array_key_exists('value', $value['value'])) { // Field collections have them nested.
$selected_options[$value['value']['value']] = $value['value']['value'];
}
elseif (is_array($value['value']) && array_key_exists('tid', $value['value'])) { // Field collections have them nested. Taxonomy
$selected_options[$value['value']['tid']] = $value['value']['tid'];
}
elseif (is_array($value['value']) && array_key_exists('nid', $value['value'])) { // Field collections have them nested. Node ref
$selected_options[$value['value']['nid']] = $value['value']['nid'];
}
elseif (is_array($value['value']) && array_key_exists('uid', $value['value'])) { // Field collections have them nested. User ref
$selected_options[$value['value']['uid']] = $value['value']['uid'];
}
I propose wrapping these if cases together like this:
if(!empty($value['value']) && is_array($value['value'])){
if (array_key_exists('value', $value['value'])) { // Field collections have them nested.
$selected_options[$value['value']['value']] = $value['value']['value'];
}
elseif (array_key_exists('tid', $value['value'])) { // Field collections have them nested. Taxonomy
$selected_options[$value['value']['tid']] = $value['value']['tid'];
}
elseif (array_key_exists('nid', $value['value'])) { // Field collections have them nested. Node ref
$selected_options[$value['value']['nid']] = $value['value']['nid'];
}
elseif (array_key_exists('uid', $value['value'])) { // Field collections have them nested. User ref
$selected_options[$value['value']['uid']] = $value['value']['uid'];
}
}
Comments
Comment #1
mikemadison CreditAttribution: mikemadison at Pacific Northwest National Laboratory commentedI started digging into this and confirmed it was a problem in 7.11. Then, I went about applying a patch but discovered this issue has already been fixed in the most current version of the development code in the repository. This would appear to be a duplicate of https://www.drupal.org/node/2527428.