I just upgraded on of my websites from Drupal 6.20 to Drupal 7, following the upgrade instructions to the letter. The upgrade itself seems to have gone fine, as I a able to get to the admin section (/admin), and no errors came up during the actual install. However, when I try to visit the main, public-facing page, I get a WSOD with the following error message:

Fatal error: [] operator not supported for strings in /home/dtdrupal/stable/includes/common.inc on line 2313

I've tried the following:

  • disabling all but the core modules
  • going back to a stock theme (Garland)
  • clearing the cache
  • running cron
  • verifying permissions on all folders and files

This also seems to happen with multiple themes (not just Garland). Hosting information is as follows:

  • PHP version 5.2.15
  • MySQL 5.1.53
  • Apache 2

Anybody have any idea what is going wrong? Worst case scenario, I do have backups, and I can revert to 6.20.

Thanks.

Comments

bluntwit@gmail.com’s picture

I think I managed to fix this. Its probably a horrible kludge, but hey, it works. I went into common.inc line 2313, and found the following line:

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

I changed it to this:

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

I'd still like to know more about why this error message was coming up in the first place. Should I be submitting a bug report about this?

drcho’s picture

I had the same problem while testing a new theme with a Panel (Node) on Drupal 7 :-( Seems to be a problem that occurrs not only in context with upgrading Drupal...

anou’s picture

I've encountered the same error when using l() in page.tpl.php.
here the code :
echo l(t('Postulez'), $pathpost, $options = array('attributes' => array('class' => 'post-'.$language->language, 'title'=>t('Postulez'))));

For every page, the l() output is :
<a title="Postulez" class="post-fr" href="/fr/node/193">Postulez</a>

But when I do remove the [] in common.inc so i can see node/193, the l() output is :
<a title="Postulez" class="active" href="/fr/node/193">Postulez</a>

You can see here that my class "post-fr" has been substitued by the class "active" from common.inc.
But for me it should have add the class active !
And If i leave the [] in common.inc i get the error and partial output of the page...

Maybe this means something to someone ?

David THOMAS
http://www.smol.org

marchudson’s picture

chaps, let's not hack the core wherever possible.

In Drupal 7 I believe you need to supply your class attribute for a link in an array format.

Example:

echo l(
    t('Example Link'),
    'your-url-path',
    array(
        'attributes' => array(
            'class' => array('classname-1', 'classname-2'),
        ),
    )
);
Dor@’s picture

Is wrong according to you mustimpress  e.g. line 460 should be  

 $decbtn = l($img_d, 'uccartpics/update/nojs/dec/'. $item['nid'] .'/'. $item['ciid'], array('html' => TRUE, 'attributes' => array('class' => array('use-ajax')), 'query' => $dest_url));