Download & Extend

Fatal error: Cannot use string offset as an array - anybody else getting this error when trying to post a YouTube video?

Project:Video CCK
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:aaron
Status:closed (fixed)

Issue Summary

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

#1

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>

#2

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.

#3

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

#4

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.

#5

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;
      }
    }

#6

Assigned to:Anonymous» 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

#7

Status:fixed» closed (fixed)
nobody click here