Opened 14 years ago
Closed 14 years ago
#15215 closed defect (bug) (fixed)
wp_count_comments throws Error Notice for unknown comment_approved types
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.2 | Priority: | normal |
Severity: | normal | Version: | 3.0.1 |
Component: | Comments | Keywords: | has-patch 3.2-early |
Focuses: | Cc: |
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)
#3
@
14 years ago
Would really be nice to have full support for custom comment statuses. You can't really do it properly now.
#4
@
14 years ago
+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.
#5
@
14 years ago
+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
Patch sets in_array check on wp_count_comments to strict.