WordPress.org

Make WordPress Core

Ticket #19222: fix-user-set-role-with-non-zero-index.diff

File fix-user-set-role-with-non-zero-index.diff, 486 bytes (added by elyobo, 4 years ago)

Patch against SVN trunk

  • wp-includes/capabilities.php

     
    721721                foreach ( (array) $this->roles as $oldrole ) 
    722722                        unset( $this->caps[$oldrole] ); 
    723723 
    724                 if ( 1 == count( $this->roles ) && $role == $this->roles[0] ) 
     724                if ( 1 == count( $this->roles ) && $role == current($this->roles) ) 
    725725                        return; 
    726726 
    727727                if ( !empty( $role ) ) {