[wp-trac] [WordPress Trac] #64223: Undefined variable $comments_count

WordPress Trac noreply at wordpress.org
Mon Nov 10 19:04:35 UTC 2025


#64223: Undefined variable $comments_count
--------------------------+---------------------
 Reporter:  zagna         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  6.9
Component:  Comments      |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+---------------------
Changes (by westonruter):

 * keywords:   => needs-patch
 * milestone:  Awaiting Review => 6.9


Comment:

 This issue is flagged by PhpStorm's static analysis as well, see
 [attachment:"phpstorm-static-anslysis.png"].

 Here is the problematic code: https://github.com/WordPress/wordpress-
 develop/blob/328ab83beb153ffa6d5378b26bb4ef2ceee49c47/src/wp-
 admin/includes/dashboard.php#L1077-L1103

 It seems a very simply fix, to just add before the `do`/`while` loop:

 {{{#!php
 <?php
 $comments_count = 0;
 }}}

 This issue appears to have been introduced in r60643 to fix #56499.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64223#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list