Opened 10 years ago
Closed 10 years ago
#32566 closed defect (bug) (fixed)
wp_notify_moderator assumes the post_author userdata exists
Reported by: | rachelbaker | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Comments | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
When attempting to notify the moderator about a new comment that is awaiting approval, the $post->post_author
userdata is assumed to exist. Which means if the $post->post_author === 0
the userdata ($user->ID) does not exist and results in a "Trying to get property of non-object" PHP notice.
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/pluggable.php#L1550
The (deprecated) function wp_notify_postauthor
did/does confirm that the $post->post_author
userdata exists before using it.
Attachments (2)
Change History (7)
Note: See
TracTickets for help on using
tickets.
Attached a patch. I believe it solves the problem in question. The main thing I am worried about it the amount of
if()
statements being nested. Let me know if that's an issue or if there is an issue with the patch in general and I will fix.