I've seen a few of these in the PHP logs:
PHP Fatal error: Cannot use string offset as an array in ..\sites\all\modules\ui_cache_clear\ui_cache_clear.module on line 172
Here's the offending line:
$data['content']['#contextual_links']['ui_cache_clear'] = array(
'admin/structure/block/ui_cache_clear',
array($block->module, $block->delta),
);
So probably at some time either $data['content'] or $data['content']['#contextual_links'] ar holding a string instead of an array.
The cause for that being not an array is sure related to something else than this module, but I'm posting this for the record. I'll investigate if we can asume that $data['content']['#contextual_links'] is always an array (it should because we're altering a renderable array for the block..).
Comments
Comment #1
kalabroI guess
$data['content']['#contextual_links']is string in your case (just because we ensure that $data['content'] is array on lines 165-171.I think we can add one more check...
Comment #2
kalabroSo @david_garcia any news? Have you found the reason of the bug? Your feedback will be very helpful.
Comment #3
david_garcia commented@kalabro thanks for the interest. I am still figuring out why is this happening, unluckily I am unable to catch the error "in-situ" and the only clue is in the fatal error logs, that have no stack trace.
Comment #4
david_garcia commentedThe error happens when $data is a string with markup.
Of course, this is a bug somewhere else, but amazingly Drupal is rendering correctly that block!
$data is supposed to be an array with a "content" and "subject" key as the Block API mandates, but we could modifiy the module to exhibit a warning instead of a fatal error.
Comment #6
kalabroWell, this commit should fix it. Could you please check is the error still exists?
Comment #7
david_garcia commentedI didn't test, but reading through the code I can confirm this will not work :(
If $data is a string, then doing $data['content'] will not convert $data into an array. (I'm not sure if a warning is being thrown).
This needs some refactoring, i'll be proposing a patch when I find some time.
Greetings and thanks!
Comment #8
david_garcia commentedComment #10
kalabroOne more try :)
Comment #11
kalabroI released 7.x-1.0-beta6 now. Feel free to reopen this issue if error still exists.
Comment #12
david_garcia commentedSorry for not giving feedback on this, I've been very bussy lately :(
The issue is gone with last changes.
Thank you very much!