PHP Fatal error: [] operator not supported for strings in panopoly_images/panopoly_images.module on line 90
$variables['attributes']['class'][] = str_replace('_', '-', $variables['style_name']);
"$variables['attributes']['class']" is a string.
my fix:
/*
https://drupal.org/node/1722146
The class attributes is a string, but drupal requires it to be
an array, so we fix it here.
$tag_info['attributes']['class'] = explode(" ", $tag_info['attributes']['class']);
*/
$variables['attributes']['class'] = explode(" ", $variables['attributes']['class']);
$variables['attributes']['class'][] = str_replace('_', '-', $variables['style_name']);
Comments
Comment #1
mglamanSocialNicheGuru, can you help explain how to replicate the error? I understand the process, but would be beneficial to pinpoint replication and test.
Comment #2
mglamanSocialNicheGuru, after investigation it appears that the issue is there is a module setting $variables['attributes']['class'] as a string, not as an array.
Your fix provides a healing method, but provides a bandaid to a bug somewhere else. If you help provide steps to reproduce and any related modules we can get this sorted out!
Comment #3
socialnicheguru commentedthanks.
I'll try to find the module and report back (debug_backtrace() here I come.
any tips on howto debug would be great.
Comment #4
lsolesen commentedHad a duplicate here #2229799: Fatal error: [] operator not supported for strings in panopoly_images.module
Comment #5
dsnopekComment #6
jpstrikesback commentedimage_class is one module that doesn't play nicely.
Comment #7
dsnopekGiven that there are a number of modules in the wild that treat this as a string (rather than array), I think we should patch panopoly_images to deal with that case. This follows the "Robustness principle":
http://en.wikipedia.org/wiki/Robustness_principle
Comment #8
Anonymous (not verified) commentedYou meant something like this?
Comment #10
dsnopekThanks, that's exactly what I meant! :-) Committed.