Title: array_key_exists error
Last modified: August 21, 2016

---

# array_key_exists error

 *  [Tim](https://wordpress.org/support/users/n7studios/)
 * (@n7studios)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/array_key_exists-error-1/)
 * 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/](http://wordpress.org/plugins/akismet/)

Viewing 1 replies (of 1 total)

 *  [Brian Shim](https://wordpress.org/support/users/brianrshim/)
 * (@brianrshim)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/array_key_exists-error-1/#post-4306570)
 * 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.

 * ![](https://ps.w.org/akismet/assets/icon-256x256.png?rev=2818463)
 * [Akismet Anti-spam: Spam Protection](https://wordpress.org/plugins/akismet/)
 * [Support Threads](https://wordpress.org/support/plugin/akismet/)
 * [Active Topics](https://wordpress.org/support/plugin/akismet/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/akismet/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/akismet/reviews/)

## Tags

 * [array_key_exists](https://wordpress.org/support/topic-tag/array_key_exists/)

 * 1 reply
 * 2 participants
 * Last reply from: [Brian Shim](https://wordpress.org/support/users/brianrshim/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/array_key_exists-error-1/#post-4306570)
 * Status: not resolved