Hello,
Whenever a new user logs into Drupal and the CAS module is ued to provision the new user, I get the following PHP notices:

• Notice: Undefined property: stdClass::$timezone in drupal_get_user_timezone() (line 1947 of /var/local/www/drupal.princeton.edu/drupal/includes/bootstrap.inc).
• Notice: Undefined property: stdClass::$timezone in system_user_login() (line 1971 of /var/local/www/drupal.princeton.edu/drupal/modules/system/system.module).

I'm using PHP 5.2.17 and Drupal 7.2. I attached a screenshot of the error.

Comments

bfroehle’s picture

And this issue does not occur on future logins of the same user?

bfroehle’s picture

Status: Active » Needs review
StatusFileSize
new1.24 KB

Can you try out this patch?

Fundamentally I think it's a problem with Drupal core... they claim that user_save() returns a "fully-loaded $user object" but I don't believe them.

bfroehle’s picture

Hmm, let's try attaching the correct patch! Please ignore #2 and consider this patch to the CAS module instead.

Status: Needs review » Needs work

The last submitted patch, 1176904-Initial-login-generates-a-timezone-war.patch, failed testing.

bfroehle’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs work » Needs review

Okay, so I guess testing won't work unless we select "7.x-1.x-dev"...? Please bear with me here..

bfroehle’s picture

bfroehle’s picture

@humansky, sorry for all of the clutter in this issue. Give the patch in comment #3 a shot. I think it should resolve your problem. Please write back with results.

As I mentioned in #2, I think this stems from an issue with Drupal core -- see #1177234: user_save doesn't return a "fully-loaded $user object".

humansky’s picture

Status: Needs review » Reviewed & tested by the community

Was able to verify several usernames and patch in comment #3 works like a charm.....thank you!!!

justintime’s picture

I can confirm the bug, and the patch that fixes it. I also concur that it's a bug in user_save -- just for fun I tried setting the 'is_new' element in the $edit array, and it didn't change anything.

bfroehle’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x-1.x-dev in 904a863ba5132f994aa83855e05f580cc3e751b9.

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

  • Commit 904a863 on 7.x-1.x, 8.x-1.x by bfroehle:
    Issue #1176904: Initial login generates a timezone warning