warning: unserialize() expects parameter 1 to be string, array given in /opt/lampp/htdocs/asokhoah/sites/all/modules/lightbox2/lightbox2.formatter.inc on line 138.

Using imagefield 6.x-3.0-alpha2 in nodes, I'm getting one of those for each imagefield image in the node.

Similar issue with this on imagecache btw, with an interesting discussion: http://drupal.org/node/299329 , wich led me to try out the following:

replaced:
$image_data = unserialize($item['data']);
with this:

  if (is_string($item['data'])) {
  $image_data = unserialize($item['data']);
 }

Which does get rid of the error, but if you use the titles don't get passed as captions... not a developer myself though.

If you have it setup to display the link to the node as caption, the html is printed out as plain text also. Maybe this gives u a clue?

CommentFileSizeAuthor
#1 lightbox2_303101.patch991 bytesstella
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stella’s picture

Status: Active » Fixed
FileSize
991 bytes

Fixed in CVS and will be included in the next dev release, available later today.

I think the problem with your change is that $image_data is not set if $item['data'] isn't a string. See if the next dev version or the attached patch fixes this for you.

Cheers,
Stella

Manuel Garcia’s picture

Status: Fixed » Active

I added the line drupal_set_message(dprint_r($item['data'], 1));

above the unserialize() function call, and this is what gets printed:

      Array
      (
          [alt] => Indonesia
          [title] => Indonesia
      )


      Array
      (
          [description] => Mujer Bordando (Bali)
          [alt] => 
          [title] => Mujer Bordando (Bali)
      )


      Array
      (
          [description] => Hombre de Bali preparando joyería tradicional
          [alt] => 
          [title] => Hombre de Bali preparando joyería tradicional
      )


      Array
      (
          [description] => Mujer Bordando (Bali)
          [alt] => 
          [title] => Mujer Bordando (Bali)
      )

      Array
      (
          [description] => Hombre de Bali preparando joyería tradicional
          [alt] => 
          [title] => Hombre de Bali preparando joyería tradicional
      )
Manuel Garcia’s picture

ow ok, we were replying at the same time, sorry

will try out what you suggest and come back to you on it

stella’s picture

Is the patch not working? If so, how not?

Manuel Garcia’s picture

Status: Active » Closed (fixed)

great that patch works perfectly - many thanks!

I guess we can close this one right :)

stella’s picture

Status: Closed (fixed) » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

stella’s picture

Released in Lightbox2 6.x-1.9.

Cheers,
Stella