Fatal error: Cannot use string offset as an array in /var/www/html/staging/williams/modules/video_cck/video_cck.module on line 162

Comments

anttih’s picture

I am getting the same. Using default settings for the module.

Here's the code from youtube:

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/hVimVzgtD6w"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/hVimVzgtD6w" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
anttih’s picture

As a workaround:

At line 162

Changed

     $node->$field_name[0]['data'] = $data;

to

     $node->$field_name['data'] = $data;

Seems to be working now (hope I didn't break anything else...). Multiple value fields still broken.

aaron’s picture

make sure you update -- the data field was just added recently, and requires running update.php

Souvent22’s picture

This error still pesists even after running update.php; i have since hacked it using the suggestion above. I still don't konw what the root of this error is, i have cleared all my cache numerous times ( as this is what the updates do ) to no avail.

deelight’s picture

I'm not sure my method is ok, but the problem was with that line :

$node->$field_name[$delta]['data'] = $data;

I fixed it using an intermediary variable ($nodefield) :

    if ($field['multiple']) {
      foreach ($items as $delta => $item) {
        $data = (array)unserialize($items[$delta]['data']);
        $nodefield = $node->$field_name;
        $items[$delta]['data'] = $data;
        $nodefield[$delta]['data'] = $data;
      }
    }
aaron’s picture

Assigned: Unassigned » aaron
Status: Active » Fixed

Fixed using the solution posted at http://drupal.org/node/153261. Could someone using php5 confirm this release works, and reopen the issue if it doesn't?

Thanks,
Aaron Winborn

Anonymous’s picture

Status: Fixed » Closed (fixed)