WordPress.org

Support

Support » Plugins and Hacks » Akismet » array_key_exists error

array_key_exists error

  • Tim Carr

    @n7studios

    We’ve been trying to debug the following issue that we were seeing in our error log, and think we’ve found the problem, and a resolution.

    [05-Nov-2013 15:48:02 UTC] PHP Warning:  Illegal offset type in isset or empty in /wp-includes/cache.php on line 618
    [05-Nov-2013 15:48:02 UTC] PHP Warning:  array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The first argument should be either a string or an integer in /wp-includes/cache.php on line 618

    The above error was happening every 24 hours, and after some digging we found that it correlated to a cron task in WordPress scheduled by Akismet. Some debugging within the akismet_delete_old function (akismet.php) revealed that the following line was causing the error:
    do_action( 'delete_comment', $comment_ids );

    Further research indicated that the W3 Total Cache plugin was hooked onto the delete_comment action, however we don’t believe that’s where the fault lies. The WordPress Codex says for the ‘delete_comment’ action: Runs just before a comment is deleted. Action function arguments: comment ID..

    In akismet.php, an array of comment IDs is submitted, causing issues for plugins using the action has defined in the WordPress Codex (a single Comment ID).

    We were able to resolve the issue by replacing the do_action with the following:

    foreach($comment_ids as $key=>$comment_id){
        do_action( 'delete_comment', $comment_id );
    }

    Hopefully you can confirm this as an issue?

    http://wordpress.org/plugins/akismet/

Viewing 1 replies (of 1 total)
  • Brian Shim

    @brianrshim

    Thank you for debugging and posting this. I’m getting the exact same problem. Hopefully Akismet will fix it.

    – Brian

Viewing 1 replies (of 1 total)
  • The topic ‘array_key_exists error’ is closed to new replies.
Skip to toolbar