Support » Fixing WordPress » class-wp-hook.php generating errors, crashing server

  • Last week randomly we started encountering errors with class-wp-hook.php, no updates that I know of had been run, error log reads:

    [01-May-2018 00:51:11 UTC] PHP Warning: array_keys() expects parameter 1 to be array, integer given in /public_html/wp-includes/class-wp-hook.php on line 271
    [01-May-2018 00:51:11 UTC] PHP Warning: current() expects parameter 1 to be array, null given in /public_html/wp-includes/class-wp-hook.php on line 275
    [01-May-2018 00:51:11 UTC] PHP Warning: Invalid argument supplied for foreach() in /public_html/wp-includes/class-wp-hook.php on line 277
    [01-May-2018 00:51:11 UTC] PHP Warning: next() expects parameter 1 to be array, null given in /public_html/wp-includes/class-wp-hook.php on line 291
    [01-May-2018 00:51:11 UTC] PHP Warning: current() expects parameter 1 to be array, null given in /public_html/wp-includes/class-wp-hook.php on line 275
    [01-May-2018 00:51:11 UTC] PHP Warning: Invalid argument supplied for foreach() in /public_html/wp-includes/class-wp-hook.php on line 277
    [01-May-2018 00:51:11 UTC] PHP Warning: next() expects parameter 1 to be array, null given in /public_html/wp-includes/class-wp-hook.php on line 291
    [01-May-2018 00:51:11 UTC] PHP Warning: current() expects parameter 1 to be array, null given in /public_html/wp-includes/class-wp-hook.php on line 275
    [01-May-2018 00:51:11 UTC] PHP Warning: Invalid argument supplied for foreach() in /public_html/wp-includes/class-wp-hook.php on line 277
    [01-May-2018 00:51:11 UTC] PHP Warning: next() expects parameter 1 to be array, null given in /public_html/wp-includes/class-wp-hook.php on line 291
    [01-May-2018 00:51:11 UTC] PHP Warning: current() expects parameter 1 to be array, null given in /public_html/wp-includes/class-wp-hook.php on line 275
    [01-May-2018 00:51:11 UTC] PHP Warning: Invalid argument supplied for foreach() in /public_html/wp-includes/class-wp-hook.php on line 277

    This cascades on for several hundred lines before the server maxes IO and crashes with a 503 error. I have tried googling for similar errors for fixes but most people who have had a similar error haven’t had a repeating error like this and it usually pointed to a specific plugin. I am at a bit of a loss.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry to hear of your troubles. There’s nothing wrong with WP_Hook class, except maybe not being tolerant of being passed inappropriate data. Used correctly, it works fine. So we need to track down what is using it incorrectly. Please install and activate the health-check plugin. Check the main tab for possible issues. Then invoke the troubleshooting mode. You should find no errors occurring in this mode.

    Next, reactivate your theme and plugins one by one, using the troubleshooting admin bar item. Test after each activation. When the errors recur, the last activated module is causing the problem by using WP_Hook incorrectly. Take up the issue with the responsible authors of that module.

    I have the same issue.
    I installed Health Check plugin, and deactivated all plugins and activated default theme too.
    but there is nothing changed. Cpanel I/O still is 100% and log file is loging report too fast that errors:

    current() expects parameter 1 to be array, null given in /home/------/public_html/wp-includes/class-wp-hook.php on line 275
    Cannot use a scalar value as an array in /home/------/public_html/wp-includes/class-wp-hook.php on line 275
    Cannot use a scalar value as an array in /home/-------/public_html/wp-includes/class-wp-hook.php on line 291
    • This reply was modified 4 years, 5 months ago by microbit.

    There is an issue with the WP Hook Class.
    It’s been discussed before, but WordPress don’t seem to care to acknowledge the reality of the open plugins nature, and that is that there are a lot of less than perfect plugins out there.

    See this thread:
    https://core.trac.wordpress.org/ticket/39338

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘class-wp-hook.php generating errors, crashing server’ is closed to new replies.