Opened 7 hours ago
Closed 4 hours ago
#64223 closed defect (bug) (fixed)
Undefined variable $comments_count
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | trunk |
| Component: | Comments | Keywords: | has-patch |
| Focuses: | Cc: |
Description
In function wp_dashboard_recent_comments if the foreach always goes to the continue, $comments_count is never set and gives a warning.
<?php add_filter( 'register_post_post_type_args', function($args, $post_type) { $args['map_meta_cap'] = false; return $args; }, 10, 2);
Adding this to twentytwentyfive functions.php for a quick reproduction on a fresh 6.9b4
Attachments (2)
Change History (7)
This ticket was mentioned in PR #10497 on WordPress/wordpress-develop by @westonruter.
5 hours ago
#2
- Keywords has-patch added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/64223
Note: See
TracTickets for help on using
tickets.
This issue is flagged by PhpStorm's static analysis as well, see 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/whileloop:This issue appears to have been introduced in r60643 to fix #56499.