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

git-svn-id: https://develop.svn.wordpress.org/trunk@8572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2008-08-06 20:31:54 +00:00
parent 3937bd9530
commit 3cab99fbd2
22 changed files with 125 additions and 124 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ class WP_Roles {
$this->role_objects = array();
$this->role_names = array();
foreach ($this->roles as $role => $data) {
foreach ( (array) $this->roles as $role => $data) {
$this->role_objects[$role] = new WP_Role($role, $this->roles[$role]['capabilities']);
$this->role_names[$role] = $this->roles[$role]['name'];
}
@@ -207,7 +207,7 @@ class WP_User {
}
function set_role($role) {
foreach($this->roles as $oldrole)
foreach( (array) $this->roles as $oldrole)
unset($this->caps[$oldrole]);
if ( !empty($role) ) {
$this->caps[$role] = true;
@@ -265,7 +265,7 @@ class WP_User {
$caps = call_user_func_array('map_meta_cap', $args);
// Must have ALL requested caps
$capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args);
foreach ($caps as $cap) {
foreach ( (array) $caps as $cap) {
//echo "Checking cap $cap<br />";
if(empty($capabilities[$cap]) || !$capabilities[$cap])
return false;