[wp-trac] [WordPress Trac] #32566: wp_notify_moderator assumes the post_author userdata exists

WordPress Trac noreply at wordpress.org
Thu Jun 4 14:40:17 UTC 2015


#32566: wp_notify_moderator assumes the post_author userdata exists
--------------------------+-----------------------------
 Reporter:  rachelbaker   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  3.1
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32566>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list