Opened 11 years ago
Closed 11 years ago
#32566 closed defect (bug) (fixed)
wp_notify_moderator assumes the post_author userdata exists
| Reported by: | rachelbaker | Owned by: | boonebgorges |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.3 |
| Component: | Comments | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.