During the configuration of an Organic Group the following error is reported:
Notice: Undefined index: masquerade_users in masquerade_user_update() (regel 432 van /srv/www/htdocs/sites/all/modules/masquerad

# drush pmi masquerade
Project : masquerade
Type : module
Title : Masquerade
Description : This module allows permitted users to masquerade as other users.
Version : 7.x-1.0-rc1
Package : Other
Core : 7.x
Status : enabled
Path : sites/all/modules/masquerade
Schema version : 7000
Files : masquerade.install, masquerade.module
Requires : none

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost’s picture

Could you provide detailed steps to reproce this notice?

radoeka’s picture

Sorry, I don't remember. Perhaps this report can be closed now, if the bug appears again or we know how to reproduce it the bug can be re-opened (or a new one can be opened.

andypost’s picture

Status: Active » Fixed

Using 'drush version 4.2' I have no this message

# drush pmi masquerade
 Project          :  masquerade
 Type             :  module
 Title            :  Masquerade
 Description      :  This module allows permitted users to masquerade as other users.
 Version:
 Package          :  Other
 Core             :  7.x
 Status           :  not installed
 Path             :  sites/drupal7/modules/masquerade
 Schema version   :  no schema installed
 Files            :  masquerade.install, masquerade.module
 Requires         :  none

# drush en masquerade
The following extensions will be enabled: masquerade
Do you really want to continue? (y/n): y
masquerade was enabled successfully.                                                                           [ok]

# drush pmi masquerade
 Project          :  masquerade
 Type             :  module
 Title            :  Masquerade
 Description      :  This module allows permitted users to masquerade as other users.
 Version:
 Package          :  Other
 Core             :  7.x
 Status           :  enabled
 Path             :  sites/drupal7/modules/masquerade
 Schema version   :  7000
 Files            :  masquerade.install, masquerade.module
 Requires         :  none

Status: Fixed » Closed (fixed)

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

Aeternum’s picture

Version: 7.x-1.0-rc1 » 7.x-1.0-rc3
Status: Closed (fixed) » Active

I have this issue too:

Notice: Undefined index: masquerade_users in masquerade_user_update() (line 443 of D:\inetpub\wwwroot\IDNCore\sites\all\modules\masquerade\masquerade.module).

I can reproduce it when logged in as user 1 (not masquerading), and either subscribing to an Organic Group or leaving an Organic Group.

bdragon’s picture

This happens whenever something does a programmatic user_save with limited scope.

masquerade is blindly assuming that $edit['masquerade_users'] exists, which isn't the case if something is calling user_save() directly with a partial $edit array that just contains the pieces that it's changing.

Drupal 7 code is supposed to be E_ALL compliant, which includes E_NOTICE notices about undefined variables.

Both isset() and empty() can be used to check possibly undefined variables without generating a notice. A good fix is to wrap the code in if (isset($edit['masquerade_users'])) { ... }. Additionally, I would argue that the if ($category == 'account') { check is unnecessary.

See http://drupal.org/node/34341 for more information.

bdragon’s picture

Title: Notice: Undefined index: masquerade_users in masquerade_user_update() (regel 432 van /srv/www/htdocs/sites/all/modules/masquerad » masquerade_user_update doesn't check whether $edit['masquerade_users'] is set, data loss occurs
Version: 7.x-1.0-rc3 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
898 bytes

This also causes loss of whatever names were in the field.

isset() is TRUE for '', so it doesn't affect the ability to clear out the field.

Patch attached.

andypost’s picture

Priority: Normal » Major
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

nathancollins44’s picture

I am also getting this Error upon new account creation.

nathancollins44’s picture

Version: 7.x-1.x-dev » 7.x-1.0-rc3
Status: Closed (fixed) » Active

I am also getting this Error upon new account creation.

Notice: Undefined index: masquerade_users in masquerade_user_update() (line 443 of /home8/kpcprodu/public_html/americanwrc/sites/all/modules/masquerade/masquerade.module).
Notice: Undefined index: masquerade_users in masquerade_user_update() (line 443 of /home8/kpcprodu/public_html/americanwrc/sites/all/modules/masquerade/masquerade.module).

How do I fix this? I might need step by step instructions, I have never installed an module patch before...

Or should I just wait for the next Masquerade module update to come out and hope it fixes the bug...

BeaPower’s picture

I also get this same error after enabling organic groups and creating a group node...

andypost’s picture

Version: 7.x-1.0-rc3 » 7.x-1.x-dev
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

  • Commit a11dd23 on master, 8.x-2.x, 8.x-2.x-admin-menu, 8.x-1.x-1836516 by andypost:
    Issue #1019832 by bdragon: masquerade_user_update doesn't check whether...

  • Commit a11dd23 on master, 8.x-2.x, 8.x-2.x-admin-menu, 8.x-1.x-1836516 by andypost:
    Issue #1019832 by bdragon: masquerade_user_update doesn't check whether...