• I have a latest WP installation with Google Authenticator plugin in version 0.54.

    At my admin user account, when I switch off “Active” option for enabling/disabling Authenticator in my Profile settings like this (for other users it’s enabled):

    Then I get this message:

    Warning: Undefined array key 0 in C:\3w\unyp2022.loc\wp-content\plugins\google-authenticator\google-authenticator.php on line 221
    

    It’s because of this portion of code:

    My returned array $user->roles returns following:

    Array
    (
        [35] => administrator
        [36] => revisor
    )

    The [0] index si not defined.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, I tested this in my dev site and I don’t see any error or warning messages. I can’t reproduce the error message you see.

    I am also running the latest plugins version 0.54 and the latest WordPress version 6.1.1.

    Kind regards.

    • This reply was modified 1 year, 10 months ago by mbrsolution.
    Thread Starter tomdux

    (@tomdux)

    Hi. Thanks for a quick reply.

    And does $user->roles returns the array as I sent you above? It means with keys not starting with key 0. I think it should be the problem that I get this.

    Hi,

    And does?$user->roles?returns the array as I sent you above?

    No, I don’t see any warning message whether I check the Active box or not.

    Kind regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘$user->roles[0]: Warning: Undefined array key 0’ is closed to new replies.