• Resolved DreamOn11

    (@dreamon11)


    Hello,

    When a user (no admin) go to admin area, there are multiple error messages:

    PHP Notice: Undefined offset: 0 in [...]/plugins/security-malware-firewall/inc/spbc-admin.php on line 471

    Can you fix it?

    Here is the code:

    $roles = (is_array($user->roles) && !empty($user->roles) ? $user->roles[0] : null); // Takes only first role.

    And a fix:

    $roles = (is_array($user->roles) && !empty($user->roles) ? reset($user->roles) : null); // Takes only first role.

    The user has contributor role.

    Thanks.

    • This topic was modified 5 years, 7 months ago by DreamOn11. Reason: Add more info
    • This topic was modified 5 years, 7 months ago by DreamOn11.
    • This topic was modified 5 years, 7 months ago by DreamOn11.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Admin area: “PHP Notice: Undefined offset: 0”’ is closed to new replies.