[wp-trac] [WordPress Trac] #25477: Notice: Trying to get property of non-object in .../wp-includes/post.php on line 2847

WordPress Trac noreply at wordpress.org
Mon Mar 10 08:31:37 UTC 2014


#25477: Notice:  Trying to get property of non-object in .../wp-includes/post.php
on line 2847
-------------------------------+------------------------------
 Reporter:  jpswade            |       Owner:
     Type:  defect (bug)       |      Status:  reopened
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  3.6.1
 Severity:  normal             |  Resolution:
 Keywords:  has-patch          |     Focuses:
-------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * component:  General => Posts, Post Types
 * milestone:   => Awaiting Review


Comment:

 Replying to [comment:10 jpswade]:
 > Either, get_taxonomy() should give an error (rather than just returning
 false) or wp_insert_attachment() should check that get_taxonomy() is
 actually returning an object or return an error.

 Either option would break backwards compatibility, as `get_taxonomy()` can
 only return an object or a boolean value, and `wp_insert_attachment()` can
 only return an integer:
 [source:tags/3.8.1/src/wp-includes/taxonomy.php#L197]
 [source:tags/3.8.1/src/wp-includes/post.php#L3966]

 We could probably add a `_doing_it_wrong()` message in there.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25477#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list