Hi!,
when I go on a page generated by on of my views (export attached) I get the following error.
Fatal error: Unsupported operand types in ...\common.inc on line 1592
It is related to this: http://drupal.org/node/362799. I've done some debuging (as described there). Here is excerpt of what debug_backtrace() returns:
array (
0 =>
array (
'file' => 'C:\\wamp\\www\\strefaimprez\\app\\includes\\menu.inc',
'line' => 1616,
'function' => 'l',
'args' =>
array (
0 => '',
1 => 'user/me/events',
2 => NULL,
),
),
1 =>
array (
'file' => 'C:\\wamp\\www\\strefaimprez\\app\\includes\\common.inc',
'line' => 100,
'function' => 'menu_get_active_breadcrumb',
'args' =>
array (
),
),
2 =>
array (
'file' => 'C:\\wamp\\www\\strefaimprez\\app\\includes\\theme.inc',
'line' => 1856,
'function' => 'drupal_get_breadcrumb',
'args' =>
array (
),
),
...
The l() function gets the input directly from menu_get_active_trail(). Here is the trail this function returns:
Array
(
[0] => Array
(
[title] => Start
[href] =>
[localized_options] => Array
(
)
[type] => 0
)
[1] => Array
(
[path] => user/%/events
[load_functions] => Array
(
[1] => views_arg_load
)
[to_arg_functions] =>
[access_callback] => views_access
[access_arguments] => a:1:{i:0;a:2:{i:0;s:39:"views_user_access_access_logged_in_user";i:1;a:5:{i:0;s:16:"user_edit_events";i:1;s:6:"page_1";i:2;s:3:"uid";i:3;s:1:"1";i:4;a:6:{i:5;i:5;i:3;i:3;i:4;i:4;i:6;i:6;i:1;i:0;i:2;i:0;}}}}
[page_callback] => views_page
[page_arguments] => a:3:{i:0;s:16:"user_edit_events";i:1;s:6:"page_1";i:2;i:1;}
[fit] => 5
[number_parts] => 3
[tab_parent] =>
[tab_root] => user/%/events
[title] =>
[title_callback] => t
[title_arguments] =>
[type] => 4
[block_callback] =>
[description] =>
[position] =>
[weight] => 1
[file] =>
[href] => user/me/events
[options] => Array
(
)
[access] =>
)
)
menu_get_active_breadcrumb() calls l() for every item in that array like this: l($parent['title'], $parent['href'], $parent['localized_options']). As can be seen, there is no ['localized_options'] in the second element of the array. And that's why l() function gets NULL as the third parameter. Because ['load_function'] is 'views_arg_load', I think the issue is related to Views.
Do you have any ideas how to resolve the problem without patching comment.inc?
Thanks!
adr_p
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | localized_options_menu.patch | 654 bytes | ttkaminski |
| #7 | me-899508-7.patch | 510 bytes | Offlein |
| view-export.txt | 13.12 KB | adr_p |
Comments
Comment #1
merlinofchaos commentedWell, that's a menu_item array out of the menu system.
In your debugging, watch the following two functions:
menu_set_active_trail()
drupal_set_breadcrumb()
Those will tell you where that breadcrumb is being set.
Comment #2
adr_p commentedIt appears the bug exists in me aliases module (it doesn't show up after I disabled this module).
How can I fix it?
Comment #3
dawehnerLet this be fixed by the me alias module.
Comment #4
IanBezanson commentedAdd the following at the top of the me_uid_optional_load() function in me.module (should be line 378):
if(!$GLOBALS['user']->uid) return;
Comment #5
Offlein commentedYes, this was super useful. I was having 403 access denied errors (it was not redirecting to my 403 page), and this solved it. I'd love to see this committed.
Comment #6
dawehnerOnly a patch can be commited.
Comment #7
Offlein commentedSigh, grumble, grumble.
Comment #8
nohup commentedcommitted
Comment #9
nohup commentedComment #10
ufku commentedI can still reproduce the issue with custom 403 page and pathauto enabled.
Here are the two simple steps to reproduce the bug:
PS: The dev branch has a different code than the patch #7 which resolves the issue.
Comment #11
ufku commentedI think it's not about only anonymous users. The script should check if the viewer(global user) has access to the user page.
Comment #12
nohup commentedufku,
Did you use the dev branch?
I did as you suggested and could not produce the error. See http://d6.codeit.in, at this site 403 is set to node and anonymous users don't have permission to access profile pages.
Patch in #7 causes this #1091434: New version 2.8 or 2.x.dev causes "access denied" pages on user profiles
Comment #13
ufku commentedYes, it's the 6.x-2.x-dev packed on on 2011-03-25
Note that you must have pathauto enabled.(version doesn't matter)
And it's reproducible for all users who does not have "access user profiles" permission.
Comment #14
timd.mackey commentedI am also experiencing the problem which ufku has described, using the most recent Dev version of 'Me' Aliases with 403 error set to a node. It doesn't appear that Pathauto has anything to do with the problem in my case. Disabling 'Me' Aliases fixes the problem.
Comment #15
rickmanelius commentedI also have this problem (6.x-2.9). Here's a simple example
user/me. When logged in, it works perfectly. When logged out, I get the following.
Fatal error: Unsupported operand types in /Library/WebServer/htdocs/IQ2/trunk/public_html/includes/common.inc on line 1593
It seems to me it's simply a problem with 'me' for anonymous users. I'd rather have some form of redirect for these cases to a page saying "You're not logged in..."
Again, it's easy to wish and I don't think I can really help here. But there is definitely still an issue here.
Comment #16
rickmanelius commentedMore details.
If I go to user/username and have logingtobbogan's 403 access denied login form to display, that is when I get the WSOD with the following warning:
Fatal error: Unsupported operand types in includes/common.inc on line 1592
If I turn off either this
Present login form on access denied (403):
or aliases me, then it works again.
So that looks like the source of the conflict... in addition to the other posts above.
Comment #17
rickmanelius commentedConfirming this is still an issue in the 6.x-2.x-dev, even with the patch in #7 visible in both stable release and dev branches.
Comment #18
brunorios1 commentedsame here
Comment #19
ttkaminski commentedI analyzed the code to see why this problem is occurring. Here's what I found is happening
If you visit page user/1 as anon, then you are denied access. If you have a custom 403 page, then drupal internally starts loading this custom page instead (which you do have access to). In the template_process_page process function, it attempts to load the breadcrumb for the page, so that I can use that for templating. No problem so far. When loading the breadcrumbs, it loads the menu router entries for the *current* page path, which in itself is not a problem, but if you look closely at the code in drupal, it implements an optimization that skips the translation step for menu entries that the user does not have access to. The result of this is that the menu router item is missing the localized_options element.
So I think that the bug is due to this performance tweak in drupal, and not anything in the me Alias module. I implemented a very simple patch to menu.inc by setting the default value for the translated_options element. I know, this is a patch to the core, but I don't see any other way.
Comment #20
Michsk commentedSame issue, this really has to get fixed. I don't think there will be a core commitment when the patch is in this issue queue. Any mod here to give some input or transfer the issue?
Comment #21
nohup commentedThe patch in 19 fixes the problem.
Here is one other thing I observed, when I disable the token module and change the alias to 'me', it works without the patch.
I figured out the issue occurs when the me module calls
token_replace, which in turn calls the token module'stoken_token_valueswhich callsdrupal_get_title, which in turn callsmenu_set_active_trailstarting the cascading effect where the trail is left corrupted.me module can fix this, by not using token replacement. Instead it provides a checkbox to allow the username to be the alias. This is like taking few step backwards and removing all the possibilities that token replace was offering.
Please comment with your views.
Comment #22
ttkaminski commentedI posted the patch in #19 to #588158-6: Occasional fatal error on custom 403 pages due to missing menu item 'localized_options' when generating breadcrumbs, so hopefully it will get noticed and merged into the core.
Comment #23
Gabriel R. commentedWe can forget about D6 core being fixed.
Is there a workaround for this via 'me' module?