Make WordPress Core


Ignore:
Timestamp:
09/09/2015 03:41:27 AM (9 years ago)
Author:
wonderboymusic
Message:

Ensure that role is not empty before adding it in add_role() function and methods.

Props MikeHansenMe, dannydehaan, michielhab.
Fixes #23746.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-roles.php

    r33752 r33967  
    173173     */
    174174    public function add_role( $role, $display_name, $capabilities = array() ) {
    175         if ( isset( $this->roles[$role] ) )
    176             return;
     175        if ( empty( $role ) || isset( $this->roles[ $role ] ) ) {
     176            return;
     177        }
    177178
    178179        $this->roles[$role] = array(
Note: See TracChangeset for help on using the changeset viewer.