Title: Fatal Error in cleanCommentRelatedRows function
Last modified: September 17, 2021

---

# Fatal Error in cleanCommentRelatedRows function

 *  Resolved [Neycho Kalaydzhiev](https://wordpress.org/support/users/neychok/)
 * (@neychok)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-in-cleancommentrelatedrows-function/)
 * Hello, wpDiscuz team!
 * We are having an issue with your plugin on one of the sites we support.
 * This is the error we get in the debug log:
 *     ```
       PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function WpdiscuzHelperOptimization::cleanCommentRelatedRows(), 1 passed in /wordpress-versions/5.7.3/wp-includes/class-wp-hook.php on line 292 and exactly 2 expected in /dom21465/wp-content/plugins/wpdiscuz/utils/class.WpdiscuzHelperOptimization.php:153
       Stack trace:
       #0 /wordpress-versions/5.7.3/wp-includes/class-wp-hook.php(292): WpdiscuzHelperOptimization->cleanCommentRelatedRows('982131')
       #1 /wordpress-versions/5.7.3/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array)
       #2 /wordpress-versions/5.7.3/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
       #3 /dom21465/wp-content/plugins/akismet/class.akismet.php(421): do_action('deleted_comment', '982131')
       #4 /wordpress-versions/5.7.3/wp-includes/class-wp-hook.php(292): Akismet::delete_old_comments()
       #5 /wordpress-versions/5.7.3/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array)
       #6 /wordpress-versions/5.7.3/wp-includes/plugin.php(551): WP_Hook->do_action(Array)
       #7 /wordpress- in /dom21465/wp-content/plugins/wpdiscuz/utils/class.WpdiscuzHelperOptimization.php on line 153
       ```
   
 * I investigated more about this and it seems that the function _cleanCommentRelatedRows_
   is passed just the first argument instead of both.
    That function is hooked to
   the “deleted_comment” action and expects two arguments to be passed to it, and
   then uses them without first checking if they exist. Thus, when Akismet does 
   the “deleted_comment” action and passes just the first argument _cleanCommentRelatedRows()_
   throws a Fatal.
 * This is my proposed fix:
 *     ```
       public function cleanCommentRelatedRows($commentId, $comment) {
            $this->dbManager->deleteSubscriptions($commentId);
            $this->dbManager->deleteVotes($commentId);
            if ( ! empty( $comment->comment_post_ID ) ) {
                $this->cleanPostCache($comment->comment_post_ID);
             }
       }
       ```
   
    -  This topic was modified 4 years, 8 months ago by [Neycho Kalaydzhiev](https://wordpress.org/support/users/neychok/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [gVectors Support](https://wordpress.org/support/users/gvectorssupport/)
 * (@gvectorssupport)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-in-cleancommentrelatedrows-function/#post-14884463)
 * Hi Neycho Kalaydzhiev,
 * Thank you for letting us know.
 * We’re going to check the issue. We’ll update this topic ASAP.
 *  Plugin Support [gVectors Support](https://wordpress.org/support/users/gvectorssupport/)
 * (@gvectorssupport)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-in-cleancommentrelatedrows-function/#post-14885254)
 * The issue will be fixed in the next version. Please wait for the next update.
   It’ll come soon
 *  Thread Starter [Neycho Kalaydzhiev](https://wordpress.org/support/users/neychok/)
 * (@neychok)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-in-cleancommentrelatedrows-function/#post-14885324)
 * Hey, thank you very much.
 * Could you give me a ETA of the next update, if possible?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Fatal Error in cleanCommentRelatedRows function’ is closed to new replies.

 * ![](https://ps.w.org/wpdiscuz/assets/icon-256x256.png?rev=1076265)
 * [Comments - wpDiscuz](https://wordpress.org/plugins/wpdiscuz/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpdiscuz/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpdiscuz/)
 * [Active Topics](https://wordpress.org/support/plugin/wpdiscuz/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpdiscuz/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpdiscuz/reviews/)

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Neycho Kalaydzhiev](https://wordpress.org/support/users/neychok/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-in-cleancommentrelatedrows-function/#post-14885324)
 * Status: resolved