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.
Comment | File | Size | Author |
---|---|---|---|
#1 | tableofcontents-1955448-1.patch | 650 bytes | ñull |
Comments
Comment #1
ñull CreditAttribution: ñull commentedYour patched prefixed the headers with "Array". My patch includes the necessary change in the next function that you probably forgot.
Comment #2
ñull CreditAttribution: ñull commentedCould someone commit this, because apparently I'm the only user around here.
Comment #3
ñull CreditAttribution: ñull as a volunteer commentedComment #4
Drupa1ish CreditAttribution: Drupa1ish at EuroDomenii commentedI'm the second user. Confirm #1 works. Thx @ñull!
Comment #5
kiralyj CreditAttribution: kiralyj commentedThe 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.
Comment #6
kiralyj CreditAttribution: kiralyj commentedAnd 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=. ]
Comment #7
ñull CreditAttribution: ñull as a volunteer commented@kiralyj, could that be a theme related issue? What happens when you switch to one of Drupal's default themes?
Comment #8
kiralyj CreditAttribution: kiralyj commentedWhen I change the theme to Bartik (Drupal's default theme), the code disappear. Thanks!I send an email to our theme developer.
Comment #9
ñull CreditAttribution: ñull as a volunteer commentedAfter 2 years this patch is still not in submitted to a release or at least a dev version. Please do so!
Comment #10
Vacilando CreditAttribution: Vacilando as a volunteer commentedHad the same problem. Confirming that #1 works.
Please COMMIT or provide (co-)maintainer rights, please.
Comment #11
kaztur CreditAttribution: kaztur commentedBecause this patch doesn't work.
Trouble in #5 and #6. The decision is not to switch to bartik and not modify the theme.
Comment #12
joelpittetThis is RTBC, thanks ñull!