Opened 10 years ago
Closed 10 years ago
#32158 closed defect (bug) (fixed)
wp_update_user() fails if email field case doesn't match
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.2.3 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | Users | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
When calling wp_update_user() if the case of the current email address matches the old email address, with the exception of the case being different, than then entire wp_update_user() call fails with an error that the email address is already in use.
example:
test @ example.com vs. test @ Example.com
This can be easily tested in the user editor by opening a usser, changing the email case only, and trying to save it.
The behavior is inconsistent in handling email addresses as either case-sensitive or not. In theory the LHS of the email address could be case sensitive, but this not the case in practice.
In any case, the change should succeed, if the check is case sensitive, then the email addresses are different and there is no duplication. If the addresses are the same, then it should succeed because its updating the current record.
Attachments (4)
Change History (12)
@
10 years ago
Updating the unit tests by @collinsinternet to make them apply cleanly and fix a couple of minor things.
#7
@
10 years ago
The 32158.test.2.diff patch was not applying cleanly for me, I noticed that there are several things that can be improved as well.
I've just submitted an updated version of the unit tests by @collinsinternet with the following improvements:
- Instead of testing for
$this->assertFalse( is_wp_error( $update ) );
, it is better to test vs. the user's ID, which is the result ofwp_update_user()
when update was successful. - Removed the unnecessary information
I believe this can easily be fixed by changing the comparison in wp_update_user() of the old and new email address to be normalized before comparison.