Jump to content

Replying to Php Warning: Invalid Argument Supplied For Foreach() In Wp-Content/plugins/better-Wp-Security/core/class-Itsec-Lockout.php On Line 339

Post Options

  or Cancel

Topic Summary


Posted 17 April 2014 - 04:25 PM

Hey John,

Be sure to stay up to date. A very near release will address this other issues!

For further support:

If you have purchased the iThemes Security Pro plugin, please post your support request here: https://ithemeshelp.zendesk.com/home

If you are using the free version, please post on the WordPress.org support forums: http://wordpress.org/support/plugin/better-wp-security



    Posted 11 April 2014 - 12:04 PM

    I just started experiencing this error after adding ithemes security.
    Page not found when looking for my homemade login url or the wp-login.php one.
    A blank white space is at the top showing:
    Warning: Invalid argument supplied for foreach() in /hermes/bosoraweb078/b1418/sl.docannco/public_html/wp-content/plugins/better-wp-security/core/class-itsec-lockout.php on line 339
    Please advise!

    Posted 08 April 2014 - 05:02 PM

    Yep... Fixed in 4.0.18. Now it does this:

    if ( is_array( $white_ips ) && sizeof( $white_ips > 0 ) ) {

    Posted 08 April 2014 - 02:54 PM

    Here's the whole error message.

    [07-Apr-2014 12:30:57 UTC] PHP Warning:  Invalid argument supplied for foreach() in .../wp-content/plugins/better-wp-security/core/class-itsec-lockout.php on line 339

    I got a few of these in my error_log and wp-admin/error_log overnight.

    Wordpress 3.8.1
    iThemes Security 4.0.17

    The line it's complaining about is the last in this group:

    $white_ips = $itsec_globals['settings']['lockout_white_list'];
    if ( $current === true ) {
        $white_ips[] = ITSEC_Lib::get_ip(); //add current user i
    foreach ( $white_ips as $white_ip ) {

    My whitelist is empty... Is it coming though as null instead of an empty list?

    Would this help?

    $white_ips = $itsec_globals['settings']['lockout_white_list'];
    if (is_null($white_ips))
        $white_ips = [];

    I also just noticed there's a Wordpress 3.8.2 and iThemes Security 4.0.18 update. I've just installed them so maybe the problem goes away...

    Oh, and the message editor on this forum sucks. It either isn't a text field or if plays with accelerators such that Cmd-Left (the key combo for "go to beginning of the line") is passed to the browser instead, which goes back and loses the whole message. I had to resort to typing out my comment in an external editor after losing my message twice!

    Review the complete topic (launches new window)