7.x-1.2 and 7.x-1xdev

Fatal error: [] operator not supported for strings in /homez.194/ikino/www/sites/all/modules/panopoly_images/panopoly_images.module on line 89

line 89 in file "panopoly_images.module" :
-------------------------------------

$variables['attributes']['class'][] = str_replace('_', '-', $variables['style_name']);

i removed this "[]" saved, uploaded file to server and now it's ok, site working.

can u fixe this for other pople, same bug in thx.

Comments

dsnopek’s picture

Project: Panopoly Images » Panopoly
Component: Code » Images

Moving to main issue queue.

lsolesen’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: -fatal error

Could you supply the exact steps to reproduce on a clean install and which version of PHP are you using?

lsolesen’s picture

Title: https://drupal.org/node/1645572 » Fatal error: [] operator not supported for strings in image.module
lsolesen’s picture

Title: Fatal error: [] operator not supported for strings in image.module » Fatal error: [] operator not supported for strings in panopoly_images.module
lsolesen’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)
stephenls’s picture

In my case, this happened because I was rendering a image using theme_image_style(), but did not contain the class for the image in an array:

So, this:

$data = theme(
         'image_style', array(
           'style_name' => 'avatar',
           'path' => $user->picture->uri,
           'title' => $user->name,
           'attributes' => array(
           'class' => 'avatar',
           )
         )
       );

rather than this:

 $data = theme(
         'image_style', array(
           'style_name' => 'avatar',
           'path' => $user->picture->uri,
           'title' => $user->name,
           'attributes' => array(
           'class' => array('avatar')
           )
         )
       );

Perhaps something similar has occurred here?