Make WordPress Core


Ignore:
Timestamp:
08/06/2008 08:31:54 PM (16 years ago)
Author:
markjaquith
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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])
Note: See TracChangeset for help on using the changeset viewer.