I got the following errors via drupal_set_message after successfully logging in for the first time with my OpenID, mikkel.hoegh.org, and thus creating my account:

* notice: Undefined index: values in /var/www/lion47/weightlog/drupal6/modules/openid/openid.module on line 118.
* notice: Undefined index: values in /var/www/lion47/weightlog/drupal6/modules/openid/openid.module on line 119.
* notice: Undefined index: values in /var/www/lion47/weightlog/drupal6/modules/openid/openid.module on line 126.

These only notices, so this is not critical.

The called OpenID URL (slightly censored)

http://wl.lion47.com/openid/authenticate?destination=node&openid.assoc_h...

Comments

cburschka’s picture

Relevant code:

    $form['name']['#default_value'] = $_SESSION['openid']['values']['name']; // #118
    $form['mail']['#default_value'] = $_SESSION['openid']['values']['mail']; // #119
    // If user_email_verification is off, hide the password field and just fill
    // with random password to avoid confusion.
    if (!variable_get('user_email_verification', TRUE)) {
      $form['pass']['#type'] = 'hidden';
      $form['pass']['#value'] = user_password();
    }
    $form['auth_openid'] = array('#type' => 'hidden', '#value' => $_SESSION['openid']['values']['auth_openid']); // #126

Diagnosis: $_SESSION['openid']['values'] isn't set.

cburschka’s picture

Before the above code is executed, the function checks for the presence of $_SESSION['openid']:


  elseif ($form_id == 'user_register' && isset($_SESSION['openid'])) {
    ...
  }

This should probably be $_SESSION['openid']['values'], although I can't quite fathom why $_SESSION['openid'] would be set if ['values'] isn't.

cburschka’s picture

Status: Active » Needs review
StatusFileSize
new931 bytes

Trivial patch. I couldn't reproduce the problem, so I can't test. Normally I'd suspect there might be more to it, but as the notices seem to be the only actual issue, this should be enough.

blueyed’s picture

I think this can be reproduced as follows:
1. Login using your OpenID
2. Go to admin/user/user/create
3. See the notices
4. Inspect $_SESSION['openid'] and see that it contains the key "user_login_values"

Apparently code in question is meant for the "Create new account" form, after logging in with an unknown OpenID failed (e.g. because of "invalid username", which is likely to be the normalized OpenID).
It seems to get triggered in two cases where it's not meant to be:
1. When the admin creates a new user
2. in openid/authenticate?destination=user, after returning from the provider (there is also only the key "user_login_values" - when trying to login using an unknown OpenID for the first time).

I've came up with the same fix (extended isset()) and it appears that everything works alright afterwards. I've tested:
- Login using attached OpenID
- Login using unknown OpenID, with sreg.nickname (=> Autoregister)
- Attaching an OpenID to an existing user

BrightLoudNoise’s picture

Version: 6.x-dev » 7.x-dev
StatusFileSize
new943 bytes

This is still an issue in HEAD, I've re-rolled the patch for HEAD and tested it locally. I can create a separate issue if that is preferred.

Status: Needs review » Needs work

The last submitted patch failed testing.

c960657’s picture

Version: 7.x-dev » 6.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.55 KB

The proposed fix was added to HEAD as part of #251245: openid.module needs tests.

Here is a backport for D6.

mikl’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks Christian :)

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed to Drupal 6.

Status: Fixed » Closed (fixed)

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