Closed (fixed)
Project:
Revisioning
Version:
6.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Jun 2009 at 21:59 UTC
Updated:
25 Jun 2009 at 18:41 UTC
Hello Rik,
After installing the latest dev version of Revisioning, I get this fatal error for all of my moderators roles.
Fatal error: Unsupported operand types in /Applications/MAMP/htdocs/guilderlanddemocrats-com-d6v12/includes/common.inc on line 1542
If I switch back to the older version of the module this error goes away.
Doesn't matter whether I have the permission to unpublish current revision checked or unchecked.
I haven't yet started to explore the code for the error. That's next.
Steve
Comments
Comment #1
wickwood commentedI forgot to mention, this only occurs when the moderator creates new content. Pure author roles create content just fine. And actually the node gets created, but you get a white screen of death if you don't have error reporting turned on for moderator roles after saving the new content.
Also, I now know that this error from includes/common.inc on line 1542 is for the l() function.
Steve
Comment #2
wickwood commentedI've narrowed the problem down to line 866 in the revisions.module file. When I comment it out and replace it with the l() function you were using, then I don't get the error.
I'm not familiar with how the theme function works (yet), but I think the error must be generated by how the data is being passed to it.
Comment #3
rdeboerHi Steve,
By default
theme('menu_item_link', $links)calls/includes/menu.inc/theme_menu_item_link($link)which in turn executesl($link['title'], $link['href'], array())just like the line you replaced.The exception is when a theme has been installed that overrides
theme_menu_item_link().I suggest you do a search for ..._menu_item_link(... across your entire drupal source code folder to find the offending code and we'll take it from there.
Rik
Comment #4
wickwood commentedHello Rik,
Glad you showed up tonight!
I had just traced down what you just told me, and I do use the hook_menu_item_link in my theme's template.php file.
Here is the code that I picked up here on the forum somewhere:
Also, from your code and what I'm reading about theme_menu_item_link() and l(), I can't figure out how $link['type'] is being used. The value is 0, and that doesn't match any of the options for l(). So what does $link['type'] do?
Thanks for your help in advance!
Steve
Comment #5
wickwood commentedHey Rik,
Fixed. I should have paid more attention to theme overriding code I used. Here is what I changed it to, and now things seem to be working correctly with the latest Revisioning module.
Here is the revised code:
I hope you don't mind me posting my "stream of thought" as I find things that cause me problems even if they in the end are not the fault of your module, but are the result of bad code elsewhere like this.
Thanks for your help and all your work these modules. There a lifesaver for me!
Steve
Comment #6
rdeboerHi Steve,
Yes that
$link['localized_options']needs to have a value, even if it's empty.Glad you were able to figure it out yourself.
Thanks for the feedback -- it's always great to hear that someone finds a good use for the modules.
After all, I got a lot out of drupal and its community, so it's only fair to put some time into giving something back.
Rik
Comment #7
wickwood commentedHello Rik,
Your little tip sent me in the right direction to solve the problem, and I appreciate your prompt replies. I know you are just as busy as the rest of us.
I have one last question for you on this topic:
Does $link['localized_options'] needs to have a value for the l() function and is this why you pass $link['type'] with a value of '0'?
From reading the API documention, I guess an $options parameter does not mean an optional parameter. It would seem that if you can send any value, then you should be able to send no value at all.
Am I understanding this correctly?
Thanks again for your help,
Steve
Comment #8
rdeboerHi Steve,
First of all, yes, when you pass NULL as the third argument to the
lfunction it crashes in the way you have experienced. But if you passarray()it's ok.Regarding $link['type']....
Certain themes, like Zen and its derivatives, e.g. Zen Classic, use the $link['type'] to do something special, like putting a "span" and style class on the
a hrefit upon rendering, when the link is of a particular type, like $link['type'] == MENU_IS_LOCAL_TASK, which is a link that is a rendered as a tab.If you download Zen (without actually installing it), you can find this behaviour coded in the function
zen_menu_item_link()So in order to play nicely with these themes, i.e. letting them override
theme_menu_item_link(),generate_revision_links_according_to_permissions($node, $link_type)allows you to pass in the $link_type, which it then passes on the the theme in question.See #489146: Output Links in the $tabs variable, comments #8, #9.
This thread contains a piece of template code you can use to render the Revisioning links as tabs.
Check out the screenshots in that thread.
And thanks attheshow for the idea!
Rik
Comment #9
rdeboer