Download & Extend

Undefined index: masquerading when login in

Project:Masquerade
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

* notice: Undefined index: masquerading in masquerade.module on line 125.
* notice: Undefined index: masquerading in masquerade.module on line 123.

<?php
function masquerade_access($type) {
  switch (
$type) {
    case
'unswitch':
      return
$GLOBALS['masquerading'] || arg(2) == 'menu-customize' || arg(2) == 'menu';
    case
'autocomplete':
      return
$GLOBALS['masquerading'] || (user_access('masquerade as user') || user_access('masquerade as admin'));
      break;
    case
'switch':
      return empty(
$GLOBALS['masquerading']) && (user_access('masquerade as user') || user_access('masquerade as admin'));
      break;
  }
}
?>

Comments

#1

In case 'unswitch' and 'autocomplete', would the following be the intended behavior?

<?php
return !empty($GLOBALS['masquerading']) || ... etc.
?>

Are you sure that the case 'unswitch' is secure enough?

#2

Status:active» fixed

I'm not sure what Gurpartap intends there, but I wrapped the globals with empty checks in 6--1.

#3

Status:fixed» closed (fixed)

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