PHP Fatal error: Unsupported operand types in ${drupalroot}/includes/theme.inc on line 1074

Created on 28 March 2013, over 11 years ago
Updated 13 July 2023, over 1 year ago

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.

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇬🇱Greenland daholythor

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024