Updated: Comment #23
Problem/Motivation:-
After upgrading drupal 6 , clicking on edit primary or secondary links leads to Fatal error Unsupported operand types in includes/common.inc on line 1551 (caused by menu.admin.inc)
Steps to reproduce the problem:-
To reproduce the problem refer to #11 and #16
#19
Proposed resolution
http://justinhileman.info/article/unsupported-operand-types-in-drupal-6x/
https://drupal.org/node/228435#comment-782632
#7
#17
Remaining tasks
Patch needs to be reviewed#21
Related Issues
http://drupal.org/node/739158#comment-2768442
Original report by @Lenn-art
After upgrading, i get this error:
Fatal error: Unsupported operand types in /home/xxx/public_html/drupal6/includes/common.inc on line 1551
This is the code around 1551 (last line is 1551)
// Merge in defaults.
$options += array(
'attributes' => array(),
'html' => FALSE,
);
Any help would be appreciated!
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | drupal.menu-translate-localized-options.21.patch | 384 bytes | sun |
| #19 | drupal6.menu-admin-localized-options.19.patch | 917 bytes | sun |
| #16 | menu.inc_.patch | 535 bytes | kristen pol |
Comments
Comment #1
MatthijsG commentedOh, and the error is only showing up when i want to edit the primary links.
Comment #2
dave reidYou might want to try adding this little bit of debugging code I wrote in http://drupal.org/node/362799. It sounds most likely that some kind of contrib module is messing this code up (since no one else has reported the problem with Drupal core).
Comment #3
darkdimSorry, I have the same problem with primary links, as Lenn-art. In section http://drupal.org/node/362799 I have written "little bit of debugging code" but the error all the same appears. What it is possible to undertake for debugging?
PS Read this http://justinhileman.info/articles/unsupported-operand-types-in-drupal-6x and add conversion code in common.inc stroke 1378
// Die.
if (!is_array($options)) {
$args = func_get_args();
echo "
"; print_r($args); echo "";
echo "
";
echo "
"; debug_print_backtrace(); die(); } The debugging code has specified for the line 71 modules menu.admin.inc where a code // Don't show callbacks; these have $item['hidden'] < 0. if ($item && $item['hidden'] >= 0) { ........ $form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['localized_options']) . ($item['hidden'] ? ' ('. t('disabled') .')' : ''); In mysql base i'm find this $item in table {menu_links} and change hidden to -1. Site works! But from what there is this error?Comment #4
MatthijsG commentedI added the code and nothing happenend ... i mean, the error is stil there.
Comment #5
darkdimsee http://justinhileman.info/articles/unsupported-operand-types-in-drupal-6x There it is described why there is this error and a method of its elimination
Comment #6
agarwal.sudhanshu commentedSame issue at /admin/build/menu-customize/secondary-links
I have tried the code
if (!is_array($options)) {
echo "
"; $backtrace = debug_backtrace(); var_export($backtrace[0]); die(); } It showed me the following result array ( 'file' => '/home/xxx/public_html/mysite/modules/menu/menu.admin.inc', 'line' => 72, 'function' => 'l', 'args' => array ( 0 => 'Submit Content', 1 => 'node/19', 2 => false, ), ) Is there any problem in menu.admin.inc on line 72 ? I have uninstalled all contributed and core-optional modules except menu module. Switched the current theme to default garlend. removed the contributed themes and modules and then again run update.php So now I have code of drupal 6.11 core only. but error still comming I think there is any problem in update script for upgrading drupal 6.10 to 6.11 this problem is coming only after upgrading existing site. new installation is working file.Comment #7
agarwal.sudhanshu commentedI searched it little bit and found that
In menu.inc line no 636
function _menu_link_translate(&$item) {
$item['options'] = unserialize($item['options']);
In above code unserialize function was returning FALSE value and this is the reason for error.
From menu_links table I searched the value of field 'option' for 'node/19' in my case.
it was
a:1:{s:10:"attributes";a:1:{s:5:"title";s:15:"Submit content";}}
I have changed it to
a:1:{s:10:"attributes";a:1:{s:5:"title";s:14:"Submit content";}}
as "Submit content" have 14 characters not 15 .
after updating this, my Issue resolved and site start working properly.
I am still not sure why it stored wrong serialized data.
Comment #8
agarwal.sudhanshu commentedComment #9
dave reidThere is no code for review or an idea how this problem was caused in the db.
Comment #10
usa2k commented#5 fixed my issue on Drupal 6.11 for comments added to the forum module.
I hope this is useful to others?
Comment #11
anthonybruno commentedIm currently having the same issue as well. After editing a page that is a primary link, the node becomes unpublished. After publishing, I get the common.inc error.
Comment #12
MatthijsG commentedreply on #7
How did you get the FALSE? I mean, how to execute this lines & where did you see that these lines gives an error?
And how did you discover that (in your case) node/19 was the 'bug'?
Comment #13
MatthijsG commentedAt least, at least, at least ... pffff
I followed exactly http://justinhileman.info/articles/unsupported-operand-types-in-drupal-6x but step 3 (Find and fix the source) did i a little different: "Add this (instead of the argument conversion code)" > i added the code. Not instead, but with the code mentioned above. The result was a nice error, which lead to the error.
The error was a node with some strange characters in the title (dutch):
‘HOOP-vol-afscheid’
I think, these where "...". The input was done with FCKeditor. Is there somewhere a filter added who can prevent this problem?
Comment #14
agarwal.sudhanshu commentedreply on #7
Hello Lenn-art
Your questions are
1. How did you get the FALSE -
$item['options'] = unserialize($item['options']); //line 637 in menu.inc
here value of $item['options'] should an array.
I used print_r( $item['options']);die; code and it displayed FALSE .
2. how did you discover that (in your case) node/19 was the 'bug'?
Please check comment #6 it
array (
'file' => '/home/xxx/public_html/mysite/modules/menu/menu.admin.inc',
'line' => 72,
'function' => 'l',
'args' =>
array (
0 => 'Submit Content',
1 => 'node/19',
2 => false,
),
it returns node/19
means there is bug in node/19
Comment #15
MatthijsG commentedTnx for the reply. I already solved it (see #13). There where some strange characters in the node-title.
Comment #16
kristen polI have seen this error when using a theme with a breadcrumb and a user that does not have access to the page in question. To reproduce:
1) use bluemarine (or other theme with breadcrumb showing)
2) create a user that does not have access to administer blocks (e.g. cannot view /admin/build/block page)
3) login as that user and go directly to /admin/build/block page (type in url)... you should see error:
Fatal error: Unsupported operand types in
C:\apache-htdocs\htdocs_vhost-classic\includes\common.inc on line 1542
Note that if you click around for awhile and go back to that page, you won't see the error anymore.
I have been able to fix this problem with a patch to _menu_translate function in the menu.inc file. For performance reasons, they do not call the _menu_item_localize function if the user doesn't have access to the page. But, in that case, the menu item does not get the 'localized_options' array initialized and then it breaks the url() function. This patch fills in an empty array if the _menu_item_localize function is not called.
I have only used this patch for 6.10 but if menu.inc did not change in 6.11 and 6.12 then the patch will work for those versions as well.
Comment #17
JerryH commentedFor me it was node-comment.tpl.php line 14 ish.
The l() call was :
print l($node->title, $_GET['q'], NULL, NULL, "comment-$node->nid") . ' ' . theme('mark', $node->new);Which is invalid for D6 : http://api.drupal.org/api/function/l/6
So I updated it to :
print l($node->title, $_GET['q'], array( NULL, NULL, "comment-$node->nid")) . ' ' . theme('mark', $node->new);debug_print_backtrace() is your friend ;)
Comment #18
RedTop commentedI have the same problem:
http://drupal.org/node/739158#comment-2768442
I did the backtrace but unfortunately my PHP-skills aren't ... well, are non-existent. :P
Pointers towards a solution are most welcome. :(
[edit]
This fix did the trick for me:
http://drupal.org/node/228435#comment-782632
Comment #19
sunSteps to reproduce:
1) Enable Contact module.
2) Enable its default "Contact" menu link and move it into Primary links.
3) Visit admin/build/menu-customize/primary-links
4) Fatal error.
Attached patch fixes the bug.
Fatal errors are critical.
I'm not able to reproduce this issue in D7/D8, so leaving at 6.x-dev.
Marked #1358422: Empty localized_options array item causes "Unsupported operand types" problem in includes/common.inc as duplicate of this issue.
Comment #20
cspiker commentedThe source of the problem for me was similar to #7 above. I had three entries in the menu_links table where the serialized string length was one too many.
I made the fix directly to the serialized data before seeing the patch in #19 so, unfortunately, I wasn't able to test it.
Comment #21
sunAttached patch contains the actually required fix.
drupal.org and the rest of the net is apparently littered with bug reports and support requests about this WSOD.
Comment #22
tedbowNeeds summary
http://drupal.org/contributor-tasks/write-issue-summary
Comment #22.0
chanderbhushan commentedUpdated issue summary.
Comment #23
chanderbhushan commentedProblem/Motivation:-
After upgrading drupal 6 , clicking on edit primary or secondary links leads to Fatal error Unsupported operand types in includes/common.inc on line 1551 (caused by menu.admin.inc)
Steps to reproduce the problem:-
To reproduce the problem refer to #11 and #16
#19
Proposed resolution
http://justinhileman.info/article/unsupported-operand-types-in-drupal-6x/
https://drupal.org/node/228435#comment-782632
#7
#17
Remaining tasks
Patch needs to be reviewed#21
Related Issues
http://drupal.org/node/739158#comment-2768442
Comment #23.0
chanderbhushan commentedUpdated issue summary.
Comment #23.1
chanderbhushan commentedUpdated issue summary.
Comment #24
rivimeyCode very similar to that fixed in Sun's changes above (#21) is present unaltered in D8.HEAD at the moment. I will therefore try to demonstrate whether that also means the bug is present in D8:
Comment #25
rivimeyRe #21 : Have you been able to reproduce the fatal error when editing primary link issue on D7?
I have spun up a D7.Head site and enabled Contact module and its menu and can edit the menu's position using the table at admin/structure/menu/manage/navigation without any issues I can see.
In D8.Head the Contact module is enabled by default, as is the Contact menu item, but it's in a menu (Footer) on it's own. I added a new menu item using the GUI to Footer and then moved contact around using the table at admin/structure/menu/manage/footer, making it a child of the new item, then back again to 1st level, up and down the list. It appears to be ok and no adverse affects were noted.
It would appear this issue (connected to menu primary links) is D6 only from these tests.
Just in case it matters (as localisation was mentioned) this was on a default English setup.
Comment #26
rivimeyMoved back to release 6.x-dev and removed D6 backport tag as cannot repro on D7 (or D8). If repro possible on D7 or 8 please provide method.
Comment #28
Paul B commentedI just ran into this in 7.56. The options column of a menu_links item had become empty for some reason.
Since unserialize("") returns FALSE, this will cause the error.
Comment #30
stephencamilo commentedComment #31
hestenetReset issue status.