When menu_breadcrumb is enabled and you navigate to a OG Forum as a member of that group, instead of being able to see the topics you get an Access Denied page and the following warning:

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in C:\xampp\htdocs\drupalogforum\sites\all\modules\og_forum\og_forum.module on line 1706.

If you view the Forum as user 1, you can see the forum but receive the same warning.

This occurs with both og_forum version 6.x-2.0-rc3 as well as the latest patch from http://drupal.org/node/386566 (#55).

Comments

coastwise’s picture

Note: when using the patch described above, the line number is 1361.

coastwise’s picture

Here is a backtrace of the warning:

Array
(
    [0] => Array
        (
            [file] => /var/www/drupal-og2.0/includes/common.inc
            [line] => 616
            [function] => drupal_set_message
            [args] => Array
                (
                    [0] => warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /var/www/drupal-og2.0/sites/all/modules/og_forum/og_forum.module on line 1361.
                    [1] => error
                )
        )

    [1] => Array
        (
            [function] => drupal_error_handler
            [args] => Array
                (
                    [0] => 2
                    [1] => array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object
                    [2] => /var/www/drupal-og2.0/sites/all/modules/og_forum/og_forum.module
                    [3] => 1361
                    [4] => Array
                        (
                            [tid] => 2
                            [user] => stdClass Object
                                (
                                    [uid] => 3
                                    [name] => tomatoe
                                    [pass] => 81dc9bdb52d04dc20036dbd8313ed055
                                    [mail] => tomatoe@localhost
                                    [mode] => 0
                                    [sort] => 0
                                    [threshold] => 0
                                    [theme] => 
                                    [signature] => 
                                    [signature_format] => 0
                                    [created] => 1250627654
                                    [access] => 1250627836
                                    [login] => 1250627836
                                    [status] => 1
                                    [timezone] => -14400
                                    [language] => 
                                    [picture] => 
                                    [init] => tomatoe@localhost
                                    [data] => a:1:{s:13:"form_build_id";s:37:"form-da9f0e644187323100e655c29e24be8f";}
                                    [sid] => 3e23e245be67db3f796a1a0b1e69a430
                                    [hostname] => 127.0.0.1
                                    [timestamp] => 1250627841
                                    [cache] => 0
                                    [session] => og_last|s:1:"1";
                                    [form_build_id] => form-da9f0e644187323100e655c29e24be8f
                                    [roles] => Array
                                        (
                                            [2] => authenticated user
                                        )
                                )
                           [gid] => 1
                        )
                )
        )

    [2] => Array
        (
            [file] => /var/www/drupal-og2.0/sites/all/modules/og_forum/og_forum.module
            [line] => 1361
            [function] => array_key_exists
            [args] => Array
                (
                    [0] => 1
                    [1] => 
                )
        )

    [3] => Array
        (
            [function] => og_forum_access_forum_page
            [args] => Array
                (
                    [0] => 2
                )
        )

    [4] => Array
        (
            [file] => /var/www/drupal-og2.0/includes/menu.inc
            [line] => 452
            [function] => call_user_func_array
            [args] => Array
                (
                    [0] => og_forum_access_forum_page
                    [1] => Array
                        (
                            [0] => 2
                        )
                )
        )

    [5] => Array
        (
            [file] => /var/www/drupal-og2.0/includes/menu.inc
            [line] => 581
            [function] => _menu_check_access
            [args] => Array
                (
                    [0] => Array
                        (
                            [path] => forum
                            [load_functions] => 
                            [to_arg_functions] => 
                            [access_callback] => og_forum_access_forum_page
                            [access_arguments] => a:1:{i:0;i:1;}
                            [page_callback] => forum_page
                            [page_arguments] => a:0:{}
                            [fit] => 1
                            [number_parts] => 1
                            [tab_parent] => 
                            [tab_root] => forum
                            [title] => Forums
                            [title_callback] => t
                            [title_arguments] => 
                            [type] => 20
                            [block_callback] => 
                            [description] => 
                            [position] => 
                            [weight] => 0
                            [file] => modules/forum/forum.pages.inc
                            [href] => forum
                            [options] => Array
                                (
                                )
                        )

                    [1] => Array
                        (
                            [0] => forum
                            [1] => 2
                        )
               )
        )

    [6] => Array
        (
            [file] => /var/www/drupal-og2.0/includes/menu.inc
            [line] => 316
            [function] => _menu_translate
            [args] => Array
                (
                    [0] => Array
                        (
                            [path] => forum
                            [load_functions] => 
                            [to_arg_functions] => 
                            [access_callback] => og_forum_access_forum_page
                            [access_arguments] => a:1:{i:0;i:1;}
                            [page_callback] => forum_page
                            [page_arguments] => a:0:{}
                            [fit] => 1
                            [number_parts] => 1
                            [tab_parent] => 
                            [tab_root] => forum
                            [title] => Forums
                            [title_callback] => t
                            [title_arguments] => 
                            [type] => 20
                            [block_callback] => 
                            [description] => 
                            [position] => 
                            [weight] => 0
                            [file] => modules/forum/forum.pages.inc
                            [href] => forum
                            [options] => Array
                                (
                                )
                        )

                    [1] => Array
                        (
                            [0] => forum
                            [1] => 2
                        )
                )
        )

    [7] => Array
        (
            [file] => /var/www/drupal-og2.0/sites/all/modules/menu_breadcrumb/menu_breadcrumb.module
            [line] => 78
            [function] => menu_get_item
            [args] => Array
                (
                )
        )

    [8] => Array
        (
            [function] => menu_breadcrumb_init
            [args] => Array
                (
                )
        )

    [9] => Array
        (
            [file] => /var/www/drupal-og2.0/includes/module.inc
            [line] => 471
            [function] => call_user_func_array
            [args] => Array
                (
                    [0] => menu_breadcrumb_init
                    [1] => Array
                        (
                        )
                )
        )

    [10] => Array
        (
            [file] => /var/www/drupal-og2.0/includes/common.inc
            [line] => 2581
            [function] => module_invoke_all
            [args] => Array
                (
                    [0] => init
                )
        )

    [11] => Array
        (
            [file] => /var/www/drupal-og2.0/includes/bootstrap.inc
            [line] => 1078
            [function] => _drupal_bootstrap_full
            [args] => Array
                (
                )
        )

    [12] => Array
        (
            [file] => /var/www/drupal-og2.0/includes/bootstrap.inc
            [line] => 989
            [function] => _drupal_bootstrap
            [args] => Array
                (
                    [0] => 8
                )
        )

    [13] => Array
        (
            [file] => /var/www/drupal-og2.0/index.php
            [line] => 16
            [function] => drupal_bootstrap
            [args] => Array
                (
                    [0] => 8
                )
        )
)
coastwise’s picture

As a quick fix, you can go into the system table and change the weight for menu_breadcrumb to 1 so that it is processed after the og ones, but I'm not sure how well that will do as a long term solution... thoughts?

dazweeja’s picture

Version: 6.x-2.0-rc3 » 6.x-2.0-rc4
StatusFileSize
new57.71 KB

Definitely a bug. Attached is a patched og_forum.module 6.x-2.0-rc4 (change file extension) which should fix this issue. I'll upload just the patch tomorrow.

coastwise’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new1.16 KB

Thanks dazweeja, it works like a charm! I went ahead and created the patch for you, might save ya a few minutes. Its the least I could do.

The attached patch is not my own work, all thanks go to dazweeja!

dazweeja’s picture

Thanks coastwise. Since the bug was in code that I contributed a few weeks ago, it's the least I could do ;)

monotaga’s picture

subscribing

Anonymous’s picture

Status: Reviewed & tested by the community » Fixed

I'll get that committed today, thanks.

dazweeja’s picture

StatusFileSize
new1.17 KB

@ Paul, I think there's a problem with the rolling of the patch, ie. it unpatches the working module so to speak. Re-rolled patch (against 6.x-2.x-dev) attached.

dazweeja’s picture

Status: Fixed » Needs review
Anonymous’s picture

Assigned: Unassigned »
Status: Needs review » Fixed

Commited to the development branch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.