Skip to content

Commit

Permalink
Do not load menu item just before determining context handler to prev…
Browse files Browse the repository at this point in the history
…ent premature access denial due to empty og context.
  • Loading branch information
Joachim Willems committed Jan 28, 2015
1 parent ad19dcb commit 66d3b72
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions og_context/og_context.module
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,6 @@ function og_context_determine_context($group_type, $item = NULL, $check_access =
return;
}

if (empty($item)) {
$item = menu_get_item();
}

$providers = og_context_negotiation_info();
foreach ($enabled_providers as $name => $ignore) {
if (empty($providers[$name])) {
Expand All @@ -379,7 +375,7 @@ function og_context_determine_context($group_type, $item = NULL, $check_access =
$invoke = FALSE;
if (!empty($provider['menu path'])) {
foreach ($provider['menu path'] as $path) {
if (strpos($item['path'], $path) === 0) {
if (strpos(current_path(), $path) === 0) {

This comment has been minimized.

Copy link
@kaaresl

kaaresl Feb 25, 2015

This causes a bug in node context negotiation. I put a line just above this with the following debug code:

        dsm('comparing: "' . current_path() . '" vs "' . $path . '"');

causing the following to be printed:

comparing: "node/1107" vs "node/%"

Yeh, this will fail.

This comment has been minimized.

Copy link
@amitaibu

amitaibu Feb 25, 2015

Member

@kaaresl ouch, can you create a PR to re-roll it. Maybe with a test ;)

/cc @HelenaEksler

$invoke = TRUE;
// Path matches, so we can break.
break;
Expand Down

0 comments on commit 66d3b72

Please sign in to comment.