Show
Ignore:
Timestamp:
08/06/08 20:31:54 (4 months ago)
Author:
markjaquith
Message:

Cast to array when using foreach(). Props santosj (and thanks for your perseverance!). fixes #2784

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/capabilities.php

    r7701 r8572  
    2929        $this->role_objects = array(); 
    3030        $this->role_names =  array(); 
    31         foreach ($this->roles as $role => $data) { 
     31        foreach ( (array) $this->roles as $role => $data) { 
    3232            $this->role_objects[$role] = new WP_Role($role, $this->roles[$role]['capabilities']); 
    3333            $this->role_names[$role] = $this->roles[$role]['name']; 
     
    208208 
    209209    function set_role($role) { 
    210         foreach($this->roles as $oldrole) 
     210        foreach( (array) $this->roles as $oldrole) 
    211211            unset($this->caps[$oldrole]); 
    212212        if ( !empty($role) ) { 
     
    266266        // Must have ALL requested caps 
    267267        $capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args); 
    268         foreach ($caps as $cap) { 
     268        foreach ( (array) $caps as $cap) { 
    269269            //echo "Checking cap $cap<br />"; 
    270270            if(empty($capabilities[$cap]) || !$capabilities[$cap])