Support » Plugin: Wordfence Security - Firewall & Malware Scan » Missing clause in condition causing PHP warnings

  • Resolved Sergio S.

    (@sergiorcs82)


    Hi,

    For months now i’ve been getting this message almost daily on any of the 30+ sites i manage: PHP Warning: array_key_exists() expects parameter 2 to be array, null given in [removed for privacy]/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989 .

    I am aware that it may be due to an intermittent communication problem between my host(s) and your server(s), and that’s fine by me.

    On said file and line, can you please prepend something like is_array($jsonData) && to the condition? (Or you can adapt wfWAFUtils::json_decode to always return an array, even if empty.)

    Thank you. Happy holidays.
    @sergiorcs82

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey @sergiorcs82,

    Thanks for sharing this. I’ve shared it with the developers. As soon as I hear back with their thoughts I’ll be sure to share them with you.

    Happy Holidays to you too!

    Thanks,

    Gerroald

    Thread Starter Sergio S.

    (@sergiorcs82)

    Hello again, @wfgerald .

    I just wanted to let you know that this problem isn’t solved yet.

    I’m a little frustrated. The solution is as easy as adding a tiny clause (which i’ve even given to you), and at least one update has been released since my report. Yet, on any given week i still get several notifications from dozens of sites, across multiple servers, on distinct locations.

    Seriously, if you want i can even do the change myself and submit a diff file for approval and merging.

    This bug is “low-hanging fruit” and i see no reason why your plugin should continue to fill up error logs across so many sites – and not just mine, but worldwide.

    Sergio

    Hey @sergiorcs82,

    My apologies for the delay with this. I have shared it with the developers, and I’ll bump them for their thoughts.

    Thanks,

    Gerroald

    Hey @sergiorcs82,

    I just wanted to let you know that we have a report filed for this, and the developers are aware. For reference, the case number is – FB9295.

    I’ll be sure to update you when I know more.

    Thanks,

    Gerroald

    Thread Starter Sergio S.

    (@sergiorcs82)

    Excellent, @wfgerald . Thank you!

    Thread Starter Sergio S.

    (@sergiorcs82)

    Hello again, @wfgerald .

    I was happy to see Wordfence release an update yesterday. I quickly updated all of my 30+ sites. I’m going to paste something below. This is just from one site. Notice the last entry date and time.

    [26-Sep-2019 07:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [01-Oct-2019 02:40:03 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [05-Oct-2019 15:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [12-Oct-2019 13:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [17-Oct-2019 20:45:03 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [13-Nov-2019 12:20:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [15-Nov-2019 20:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [15-Nov-2019 23:35:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [16-Nov-2019 01:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [16-Nov-2019 01:45:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [27-Nov-2019 14:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [30-Nov-2019 22:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [12-Dec-2019 19:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [24-Dec-2019 06:25:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [28-Dec-2019 13:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [05-Jan-2020 15:35:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [05-Jan-2020 22:00:06 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [09-Jan-2020 13:45:08 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [11-Jan-2020 21:10:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [12-Jan-2020 09:30:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [15-Jan-2020 05:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [20-Jan-2020 11:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [20-Jan-2020 14:10:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [20-Jan-2020 15:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [21-Jan-2020 00:20:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [25-Jan-2020 11:25:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [27-Jan-2020 06:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [28-Jan-2020 15:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [30-Jan-2020 20:30:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [31-Jan-2020 01:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [31-Jan-2020 03:00:07 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [04-Feb-2020 11:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [04-Feb-2020 14:25:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [04-Feb-2020 16:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [04-Feb-2020 20:45:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [04-Feb-2020 21:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [04-Feb-2020 21:30:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [04-Feb-2020 22:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [07-Feb-2020 13:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [07-Feb-2020 15:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [07-Feb-2020 21:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [07-Feb-2020 22:00:03 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [07-Feb-2020 23:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [08-Feb-2020 06:25:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [08-Feb-2020 07:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [10-Feb-2020 22:30:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [11-Feb-2020 00:30:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [11-Feb-2020 07:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [12-Feb-2020 16:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [13-Feb-2020 17:00:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [14-Feb-2020 00:30:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [14-Feb-2020 05:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [14-Feb-2020 06:25:05 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [14-Feb-2020 07:50:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989
    [14-Feb-2020 08:00:04 UTC] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in {{redacted for privacy}}/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 1989

    This just showed me how little the Wordfence Dev team cares about the quality of its code.

    I’m going to close this topic and start switching my sites to Sucuri. I’ll advise all of my clients to do the same.

    Still, thank you @wfgerald for all your efforts. Have a great day!

    • This reply was modified 1 year ago by Sergio S.. Reason: Correct markup
    trudslev

    (@trudslev)

    @wfgerald Any idea when this will be fixed? It’s making my cron jobs not always run correctly.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Missing clause in condition causing PHP warnings’ is closed to new replies.