Noticed that field_group assumes that all formatter settings are either #options or strings. We have a setup where we add a nested configuration and the following block of code in field_group.module would end up passing an array (our nested settings) to drupal_strlen

      if (isset($group_form['instance_settings'], $group_form['instance_settings'][$key]['#options'])) {
        if (is_array($value)) {
          $value = implode(array_filter($value), ', ');
        }
        else {
          $value = $group_form['instance_settings'][$key]['#options'][$value];
        }
      }

      // Shorten the string.
      if (drupal_strlen($value) > 38) {
        $value = truncate_utf8($value, 50, TRUE, TRUE);
      }

which ended up giving notices like the following.

Warning: mb_strlen() expects parameter 1 to be string, array given in drupal_strlen() (line 482 of /includes/unicode.inc).
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1571 of /includes/bootstrap.inc).

I have modified code so that for now it will skip anything that is not either a plain string, or an array produced by #options

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danquah created an issue. See original summary.

danquah’s picture

sime’s picture

Status: Needs review » Fixed

7.x-2.x branch hasn't been updated in 8 years and doesn't have a recommended release. I'm closing all 7.x-2.x issues that are over 2 years old.

I'm going to mark this as fixed, to indicate there is a patch that can be used (thanks danquah), noting that is unlikely to be applied to the module.

Status: Fixed » Closed (fixed)

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