Opened 3 years ago
Closed 2 years ago
#15215 closed defect (bug) (fixed)
wp_count_comments throws Error Notice for unknown comment_approved types
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Component: | Comments | Version: | 3.0.1 |
| Severity: | normal | Keywords: | has-patch 3.2-early |
| Cc: | batmoo@… |
Description
If you have any comments with a comment_approved value of an "unknown type" (i.e. anything other than '0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed'), wp_count_comments throws an error notice.
Notice: Undefined index: 'my-custom-approved' in /Users/moo/Sites/dev/WordPress/wp-includes/comment.php on line 858
Setting the in_array check to strict, fixes the error.
Attachments (2)
Change History (10)
- Keywords 3.2-early added
- Milestone changed from Awaiting Review to Future Release
comment:3
markjaquith — 2 years ago
Would really be nice to have full support for custom comment statuses. You can't really do it properly now.
+1 Patch looks good in my eyes, strict check is reasonable. Everything else can be done in an additional ticket if there really is a want for it.
+1
Please re-consider fixing this ASAP, i.e. before 3.2, but maybe with another minor version number release, as this has me changing core to avoid the notices thrown, and it makes the update process much more annoying (but I want to stay updated in case of any security issues)!
Thank you.
I've added another patch that removes the unneccessary $known_types variable
Notices aren't enough for point releases. Especially for API usage that is technically unsupported.

Patch sets in_array check on wp_count_comments to strict.