Hi, thanks for the great module!

Profile2 alters the user_profile_form. simplesamlphp_auth adds simplesaml_auth_user_profile_form_submit to the submit handlers for the user_profile_form in certain circumstances.

When submitting the user_profile_form when editing a profile, a fatal error is thrown:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'authname' cannot be null: UPDATE {authmap} SET authname=:db_update_placeholder_0 WHERE ( (uid = :db_condition_placeholder_0) AND (module = :db_condition_placeholder_1) ); Array ( [:db_update_placeholder_0] => [:db_condition_placeholder_0] => 13711 [:db_condition_placeholder_1] => simplesamlphp_auth ) in simplesaml_auth_user_profile_form_submit() (line 308 of DOCROOT/sites/all/modules/contrib/simplesamlphp_auth/simplesamlphp_auth.module).

This is because in simplesaml_auth_user_profile_form_submit the 'name' value is being pulled directly from $form_state['values'].

When submitting the form, there's always a $form_state['user'] variable available to us in submit handlers, so I propose using that variable to get the uid and the user name for updating the authmap table, rather than trying to get the values out of $form_state['values'] directly.

Patch to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jlandfried’s picture

Status: Active » Needs review
FileSize
936 bytes

Patch referenced in OP is attached. This seems like a low impact way of making it compatible with profile2, without having to do any profile2-specific checks.

jlandfried’s picture

Actually, it probably just makes more sense to only alter the user_profile_form if the user_category is 'account', that way this isn't getting attached to any versions of the form except for the one that core provides. Then the submit handler doesn't need to be altered at all either.

Updated patch attached.

snufkin’s picture

Status: Needs review » Needs work

Could you reroll please?

jlandfried’s picture

Status: Needs work » Needs review
FileSize
1.79 KB

No problem!

snufkin’s picture

Status: Needs review » Fixed

Committed, thanks!

  • snufkin committed 2949ed2 on 7.x-3.x authored by jiff
    Issue #2545602 by jiff: Incompatibility with profile2
    

Status: Fixed » Closed (fixed)

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