Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/23/2017 01:39:31 PM (3 years ago)
Author:
dcavins
Message:

Handle missing parameter in group admin fetching functions.

In some situations, bp_group_has_moderators() is
being called without a $group parameter, causing the
downstream functions problems. This commit adds an
early return if the required parameter isn’t supplied.
It also recognizes when the cache request returns false
and skips the integer casting step.

Fixes #7524.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/groups/class-bp-groups-member.php

    r11604 r11609  
    13541354        $this->assertEquals( $user, $user_obj->id );
    13551355    }
     1356
     1357    /**
     1358     * @group get_group_moderator_ids
     1359     */
     1360    public function test_groups_get_group_mods_bad_id() {
     1361        $mods = groups_get_group_mods( null );
     1362
     1363        $this->assertTrue( is_array( $mods ) && empty( $mods ) );
     1364    }
     1365
     1366    /**
     1367     * @group get_group_moderator_ids
     1368     */
     1369    public function test_groups_get_group_admins_bad_id() {
     1370        $admins = groups_get_group_admins( null );
     1371
     1372        $this->assertTrue( is_array( $admins ) && empty( $admins ) );
     1373    }
    13561374}
Note: See TracChangeset for help on using the changeset viewer.