As of now, I'm only using context to essentially replace the block module. I was getting this notice with beta3 as well, but hadn't reported it.

Notice: Array to string conversion in theme_context_block_script_placeholder() (line 66 of /.../context/theme/context_reaction_block.theme.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thorsten.’s picture

I get exactly the same error.

eagle82’s picture

I was receiving this error, I handled it by adding the following:

<?php
if (is_array($text)) $text = serialize($text);
?>

I've attached a patch for it.

bleen’s picture

Status: Active » Reviewed & tested by the community

This seems to be the correct fix and it works in my testing

bleen’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
794 bytes

errrr .... but it is not correct in terms of coding standards.

This is more betterer

eagle82’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the correction on the coding standards. This should be patched, it's an annoying little issue.

bleen’s picture

I'm not going to un-mark this as RTBC, but I think I might have been sleep-coding at the time I reviewed/re-patched this...

The correct solution would be to ensure that only a string is ever passed into the theme function and not simply serilizing the array. In fact printing out the serialized array in the HTML output is just weird. It does serve as a good workaround for the time being though...

skwashd’s picture

Status: Reviewed & tested by the community » Needs work

I agree with @bleen18. This is just hiding a symptom of a deeper problem.

kurtzhong’s picture

In my case this notice is caused by the admin module, do you all use this module as well?

kurtzhong’s picture

Maybe this is just a theming function issue.

jbrown’s picture

Version: 7.x-3.0-beta4 » 7.x-3.0-beta5
Status: Needs work » Reviewed & tested by the community

This works!

skwashd’s picture

Version: 7.x-3.0-beta5 » 7.x-3.x-dev
Status: Reviewed & tested by the community » Needs review
FileSize
1.13 KB

The patch proposed by @kurtzhong doesn't account for the case where $text could still be a string - as per the original implementation and method signature suggesting. The attached version handles that. We have this running on a couple of projects already.

kurtzhong’s picture

I just think that the theme function should receive parameters as defined by hook_theme.

$items['context_block_script_placeholder'] = array(
    'variables' => array('text' => NULL),
    'path' => drupal_get_path('module', 'context') . '/theme',
    'file' => 'context_reaction_block.theme.inc',
  );

And we don't call theme_context_block_script_placeholder directly instead of theme('context_block_script_placeholder', $vars)'. Please correct me if i am wrong.

dealancer’s picture

Patch #11 works well for me.

semei’s picture

Could we please get this into the dev?!

jbrown’s picture

When is the parameter a string? Shouldn't a theme function follow the standard parameters?

chrisroane’s picture

#11 worked for me as well. I am using the admin module with a custom theme.

mari3.14’s picture

#11 worked like a charm

Finn Lewis’s picture

Status: Needs review » Reviewed & tested by the community

#11 also works fine for me.
Still not committed to dev branch?
Is this where we mark it RTBC?

criscom’s picture

#11 also worked for me. Using admin module with Omega subtheme.

idflood’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
692 bytes

I've made the change like kurtzhong said in #12. The following patch should fix the root of the issue.

brunodbo’s picture

Patch in #20 works for me. Changed double quotations to single to follow the style Context uses, since there is no hard standard for this in Drupal.

thorsten.’s picture

Thanks 4 the patch!
Works great.

skwashd’s picture

Status: Needs review » Reviewed & tested by the community

Works for me.

tekante’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in commit 3ed08f32a11a39082879940588f6d020b23af852 using patch from #21 since theme functions should expect a variables array. Thanks for the bug report, patch and testing.

Status: Fixed » Closed (fixed)

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

ivanhelguera’s picture

Still getting the message with the beta 7. I'm using D7.23 on Apache 2.2/PHP 5.4 (Ubuntu 13.04).
IH

kilrizzy’s picture

Getting the same error

marameodesign’s picture

subscribe

D7Newbie’s picture

Issue summary: View changes

I'm getting 'Notice: Array to string conversion in theme_item_list() (line 2223 of /var/www/html/includes/theme.inc).'

The problem appears to be a div in the custom theme template.

It's outputting
div class "region region-content" data-thmr="thmr_249"
div id="block-system-main" class="block clock-system" data-thmr="thmr_248"
div class="block-content clearfix" - instead of div class="content"

It must be a template in the theme and not the inc file, because all the other themes work fine.
Any idea what template outputs that div - is it page?