I think that there is a problem in the common.inc file on line 2353 that has been open for a while. Perhaps it is due to the particular version of PHP and the settings one uses. I will include my info later.

The error message: "Fatal error: [] operator not supported for strings in /home/opsispeace/drupal7/includes/common.inc on line 2353"

Here is the code from /includes/common.inc, with line 2353 being the second to last as displayed:

function l($text, $path, array $options = array()) {
  global $language_url;
  static $use_theme = NULL;

  // Merge in defaults.
  $options += array(
    'attributes' => array(),
    'html' => FALSE,
  );

  // Append active class.
  if (($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) &&
      (empty($options['language']) || $options['language']->language == $language_url->language)) {
    $options['attributes']['class'][] = 'active';
  }

The error message goes away if we change line 2353 to:

    $options['attributes']['class'][0] = 'active';

The way I read the code, this change should be made. $options['attributes'] is defined immediately above as an array, but without the key 'class'. Thus, line 2353 is trying to add the key 'class' to the attributes array, but without specifying that $options['attributes']['class'] should be an array. My system assumes it to be a string and then complains that "[]" is an invalid operator for a string. With the change of adding a zero, it forces $options['attributes']['class'] to be an array, with the first element being defined. Problem solved.

Drupal 7.14
PHP Version 5.3.13
Server API CGI/FastCGI

Comments

marcingy’s picture

Status: Active » Closed (won't fix)

This is not a bug a module call this function is incorrectly passing a string rather an array.

aaronbauman’s picture

Version: 7.14 » 7.x-dev
Status: Closed (won't fix) » Active

Shouldn't this throw an exception, instead of dying on a fatal error?

marcingy’s picture

Status: Active » Closed (won't fix)

No the calling code should be fixed the line in question is adding a class to an array but in the options it is an array and it should be an array.