• Resolved jondaley

    (@jondaley)


    The check for permissions has a bug in it.

    This error appears when working with a role that doesn’t have permissions (my site allows anyone to register, but doesn’t give them very many permissions, and if they do things they aren’t allowed to do (and don’t have links for) they they get a “badguy” role and locked out. So, probably normal sites don’t see it, but the code is still wrong.

    PHP message: PHP Warning: array_merge(): Argument #2 is not an array in /wp-content/plugins/members/inc/functions-users.php on line 51

    PHP message: PHP Warning: array_keys() expects parameter 1 to be array, null given in /wp-content/plugins/members/inc/functions-users.php on line 51

    Here is the fix:

    wp-content/plugins/members/inc>diff functions-users.php~ functions-users.php                                                                                                                                              1:14am
    50,51c50,51
    < 		if ( ! is_null( $role_obj ) )
    < 			$denied_caps = array_merge( $denied_caps, array_keys( $role_obj->capabilities, false ) );
    ---
    > 		if ( ! is_null( $role_obj && is_array($denied_caps) && is_array($role_obj->capabilities) ) )
    > 			$denied_caps = array_merge( $denied_caps, array_keys( $role_obj->capabilities ) );
    

The topic ‘Bug: line 51 functions-users.php: no is_array() check’ is closed to new replies.