Problem

If the module is active and the requested page contains already a table of contents, the whole requests ends up as a HTTP 500 "Unsupported operand types in ${drupalroot}/includes/theme.inc on line 1074" due to a call to theme() with a non-array-variable as second parameter.

This problem occured after a PHP upgrade from 5.2 to 5.4. Before it worked all well - I can't tell why this problem seems to happen only after the upgrade.

Proposed resolution

# diff -wu all/modules/tableofcontents/tableofcontents.themes.inc.20130328 all/modules/tableofcontents/tableofcontents.themes.inc
--- all/modules/tableofcontents/tableofcontents.themes.inc.20130328 2013-03-28 15:37:37.000000000 +0100
+++ all/modules/tableofcontents/tableofcontents.themes.inc 2013-03-28 15:33:22.000000000 +0100
@@ -272,7 +272,8 @@

// we add a space at the end (before the title)
$output = $toc['numbering']['prefix'] . $result . $toc['numbering']['suffix'] . ' ';
- return theme('tableofcontents_number_text', $output);
+ //return theme('tableofcontents_number_text', $output);
+ return theme('tableofcontents_number_text', array('output' => $output));
}

/**

Remaining tasks

For I am not an experienced PHP programmer someone should review my proposed change and test it thoroughly ;-) All I can say is, that after I applied this change, all sites were rendered successfully.

CommentFileSizeAuthor
#1 tableofcontents-1955448-1.patch650 bytesñull
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ñull’s picture

Status: Active » Needs review
FileSize
650 bytes

Your patched prefixed the headers with "Array". My patch includes the necessary change in the next function that you probably forgot.

ñull’s picture

Status: Needs review » Reviewed & tested by the community

Could someone commit this, because apparently I'm the only user around here.

ñull’s picture

Drupa1ish’s picture

I'm the second user. Confirm #1 works. Thx @ñull!

kiralyj’s picture

The patch is working, but after the patch something showed up in many regions like header, left sidebar, footer:

_show=0 box::collapsed=0 header::id_strip::digits=0 header::id_strip::dashes=0 header::id_strip::periods=0 header::id_strip::underscores=0 header::id_strip::colons=0 header::id_prefix=hdr header::id_sep=- header::id_gen=title header::allowed=%3Cem%3E+%3Ci%3E+%3Cstrong%3E+%3Cb%3E+%3Cu%3E+%3Cdel%3E+%3Cins%3E+%3Csub%3E+%3Csup%3E+%3Ccite%3E+%3Cstrike%3E+%3Cs%3E+%3Ctt%3E+%3Cspan%3E+%3Cfont%3E+%3Cabbr%3E+%3Cacronym%3E+%3Cdfn%3E+%3Cq%3E+%3Cbdo%3E+%3Cbig%3E+%3Csmall%3E back_to_top::label=Fel back_to_top::location=bottom back_to_top::minlevel=2 back_to_top::maxlevel=6 back_to_top::anchor=toc back_to_top::scroll=0 numbering::method=0 numbering::headers=0 numbering::mode=0 numbering::prefix= numbering::separator=. numbering::suffix=. ]

I don't know how to hide it.

kiralyj’s picture

And this:

[toc on_off::hide=0 on_off::automatic=1 on_off::min_limit=5 box::title=Tartalomjegyz%C3%A9k box::minlevel=2 box::maxlevel=6 box::hide_show=1 box::collapsed=0 header::id_strip::digits=0 header::id_strip::dashes=0 header::id_strip::periods=0 header::id_strip::underscores=0 header::id_strip::colons=0 header::id_prefix=hdr header::id_sep=- header::id_gen=title header::allowed=%3Cem%3E+%3Ci%3E+%3Cstrong%3E+%3Cb%3E+%3Cu%3E+%3Cdel%3E+%3Cins%3E+%3Csub%3E+%3Csup%3E+%3Ccite%3E+%3Cstrike%3E+%3Cs%3E+%3Ctt%3E+%3Cspan%3E+%3Cfont%3E+%3Cabbr%3E+%3Cacronym%3E+%3Cdfn%3E+%3Cq%3E+%3Cbdo%3E+%3Cbig%3E+%3Csmall%3E back_to_top::label=Fel back_to_top::location=bottom back_to_top::minlevel=1 back_to_top::maxlevel=6 back_to_top::anchor=toctop back_to_top::scroll=0 numbering::method=0 numbering::headers=0 numbering::mode=0 numbering::prefix= numbering::separator=. numbering::suffix=. ]

ñull’s picture

@kiralyj, could that be a theme related issue? What happens when you switch to one of Drupal's default themes?

kiralyj’s picture

When I change the theme to Bartik (Drupal's default theme), the code disappear. Thanks!I send an email to our theme developer.

ñull’s picture

After 2 years this patch is still not in submitted to a release or at least a dev version. Please do so!

Vacilando’s picture

Had the same problem. Confirming that #1 works.

Please COMMIT or provide (co-)maintainer rights, please.

kaztur’s picture

Because this patch doesn't work.

Trouble in #5 and #6. The decision is not to switch to bartik and not modify the theme.

joelpittet’s picture

This is RTBC, thanks ñull!