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

Comments

merlinofchaos’s picture

Well, 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.

adr_p’s picture

It appears the bug exists in me aliases module (it doesn't show up after I disabled this module).
How can I fix it?

dawehner’s picture

Project: Views (for Drupal 7) » me aliases
Version: 6.x-2.11 » 6.x-2.x-dev
Component: Views Data » Code

Let this be fixed by the me alias module.

IanBezanson’s picture

Add the following at the top of the me_uid_optional_load() function in me.module (should be line 378):

if(!$GLOBALS['user']->uid) return;

Offlein’s picture

Status: Active » Needs review

Yes, 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.

dawehner’s picture

Status: Needs review » Active

Only a patch can be commited.

Offlein’s picture

Status: Active » Needs review
StatusFileSize
new510 bytes

Sigh, grumble, grumble.

nohup’s picture

Status: Needs review » Fixed

committed

nohup’s picture

Status: Fixed » Closed (fixed)
ufku’s picture

Status: Closed (fixed) » Active

I can still reproduce the issue with custom 403 page and pathauto enabled.

Here are the two simple steps to reproduce the bug:

  1. Set "node"(or any other accessible path) for 403 path at admin/settings/error-reporting
  2. Visit page user/1 as a visitor(anonymous user with no permission to see profile pages)

PS: The dev branch has a different code than the patch #7 which resolves the issue.

ufku’s picture

I think it's not about only anonymous users. The script should check if the viewer(global user) has access to the user page.

nohup’s picture

ufku,

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

ufku’s picture

Yes, 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.

timd.mackey’s picture

I 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.

rickmanelius’s picture

I 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.

rickmanelius’s picture

More 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.

rickmanelius’s picture

Confirming 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.

brunorios1’s picture

same here

ttkaminski’s picture

Issue tags: +menu.inc translated_options
StatusFileSize
new654 bytes

I 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.

  $router_item['options'] = array();
  _menu_check_access($router_item, $map);

  // For performance, don't localize an item the user can't access.
  if ($router_item['access']) {
    _menu_item_localize($router_item, $map);
  }

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.

Michsk’s picture

Same 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?

nohup’s picture

The 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's token_token_values which calls drupal_get_title, which in turn calls menu_set_active_trail starting 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.

ttkaminski’s picture

I 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.

Gabriel R.’s picture

We can forget about D6 core being fixed.
Is there a workaround for this via 'me' module?