Closed thepurpleblob closed 1 year ago
duplicates #734 - will try to get a new release out soon.. - was hoping to do a simplesaml update at the same time...
hope you have a good Christmas!
Ahh.... I did look but I missed it.
Hoe you have a good Christmas too :)
Version: 2022111700 Moodle: 3.11.11
When creating a new user with SAML2 the above notice is thrown.
Analysis: This error is occurring in function update_user_record_from_attribute_map(&$user, $attributes, $newuser= false) At the above line a call to $this->is_email_taken($email, $user->username) is made which tries to get the username from the $user record.
However... The update_user_record_from_attribute_map function is being called from within function saml_login_complete, specifically the block starting around line 670 that checks for !$user and then creates $user as an empty object. When update_user_record_from_attribute_map is called at line 696, $user is still an empty object and therefore the call to is_email_taken will generate a notice.
An additional check is required for $user->username having a value.