[wp-trac] [WordPress Trac] #30566: Fix "Trying to get property of non-object" notice when calling get_blogaddress_by_id() with an invalid id.

WordPress Trac noreply at wordpress.org
Mon Dec 1 22:22:12 UTC 2014


#30566: Fix "Trying to get property of non-object" notice when calling
get_blogaddress_by_id() with an invalid id.
--------------------------------+------------------------------
 Reporter:  nerrad              |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Networks and Sites  |     Version:  trunk
 Severity:  normal              |  Resolution:
 Keywords:  needs-unit-tests    |     Focuses:  multisite
--------------------------------+------------------------------

Comment (by nerrad):

 Would be even better if the object was not a stdClass object and instead
 an actual `WP_Site_Blog` object or something like that because then one
 could just do an `instanceof` check.  But that's a much bigger deal
 outside the scope of the ticket.  The isset() checks would be fine too.

 The point is there needs to be SOME sort of validation of the returned
 value here.

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


More information about the wp-trac mailing list