• Resolved misatotremor

    (@misatotremor)


    There is a PHP warning upon user login:
    Warning: Undefined array key "enforcement-policy" in plugins/wp-2fa/includes/classes/Admin/User.php on line 362

    IMHO the line should contain an isset check or use WP2FA::get_wp2fa_setting.

    If it helps this is an install updated from WP 2FA v1.

    • This topic was modified 2 years, 11 months ago by misatotremor. Reason: Leftover formatting in message
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor robertabela

    (@robert681)

    Hello @misatotremor

    Thank you very much for using our plugin and for posting this issue.

    Would you be able to give us more details so we can understand the context of the issue? For example, when is this warning being triggered? The more information you can share with us the better we can understand the issue.

    Looking forward to hearing from you.

    Thread Starter misatotremor

    (@misatotremor)

    This warning is triggered upon login. It happens for users with 2FA enabled and those who don’t have it enabled.

    On our sites the options wp_2fa_policy value is a:0:{} therefor the current code tries to access a non-existing array key. I could fix this in my install by changing https://plugins.trac.www.ads-software.com/browser/wp-2fa/trunk/includes/classes/Admin/User.php#L361 and #L362 from
    $settings = SettingsUtils::get_option( WP_2FA_POLICY_SETTINGS_NAME );
    if ( ! is_array( $settings ) || 'do-not-enforce' === $settings['enforcement-policy'] ) {
    to
    if ( 'do-not-enforce' === WP2FA::get_wp2fa_setting( 'enforcement-policy' ) ) {.

    • This reply was modified 2 years, 11 months ago by misatotremor.
    Plugin Contributor robertabela

    (@robert681)

    Thank you for the update @misatotremor

    We are looking into this and will make sure it is addressed in the next update. In the meantime, if you have any other questions or feedback, please get in touch.

    Have a great day and all the best this festive season.

    Same issue here:
    [… date and time …] PHP Warning: Undefined array key “enforcement-policy” in /home/…../public_html/wp-content/plugins/wp-2fa/includes/classes/Admin/User.php on line 362

    Great plugin by the way

    Plugin Contributor robertabela

    (@robert681)

    Hello @kanetweb and @misatotremor

    We have identified and fixed the issue.

    We have prepared a version update of the plugin with the fix, which you can install. Please download this version update of WP 2FA and install it.

    We have tested it ourselves, however, it would be great if you can also confirm the fix.

    Looking forward to hearing from you.

    Thread Starter misatotremor

    (@misatotremor)

    Hello @robert681

    Thank you very much for the update! I can confirm this fixes the issue for us.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP warning on login’ is closed to new replies.