Undefined index and incorrect behaviour in WP_User::set_role().
|Reported by:||elyobo||Owned by:||nacin|
set_role in WP_User assumes that if the count of roles is one, then the only role present is at index 0; it seems that this is not always the case.
This is easily fixed by using current($this->roles) instead of $this->roles; the behaviour is otherwise the same, but it will work without triggering a notice and will correctly short circuit the function when the only element is at a non-zero index.
A patch against the current SVN trunk is attached.
Change History (10)
- Component changed from General to Role/Capability
- Keywords reporter-feedback removed
- Milestone changed from Awaiting Review to Future Release
- Type changed from defect (bug) to enhancement