WordPress.org

Ready to get started?Download WordPress

Forums

Akismet
array_key_exists error (2 posts)

  1. n7 Studios
    Member
    Posted 8 months ago #

    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/

  2. Brian Shim
    Member
    Posted 8 months ago #

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

    - Brian

Reply

You must log in to post.

About this Plugin

About this Topic