[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 Jan 12 14:58:38 UTC 2015


#30566: Fix "Trying to get property of non-object" notice when calling
get_blogaddress_by_id() with an invalid id.
--------------------------------+-------------------------
 Reporter:  nerrad              |       Owner:  jeremyfelt
     Type:  defect (bug)        |      Status:  reopened
 Priority:  normal              |   Milestone:  4.2
Component:  Networks and Sites  |     Version:  3.0
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  multisite
--------------------------------+-------------------------

Comment (by nerrad):

 Replying to [comment:18 SergeyBiryukov]:
 > Looks like `get_blog_details()` returns false on failure.
 >
 > Could we just check for a truthy value and remove the `isset()` checks?
 See [attachment:30566.patch].

 I was going to just check for a truthy value, but get_blog_details() also
 has a late filter run on it.  So its *possible* a plugin might return a
 non truthy value.  The isset checks cover that possibility.

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


More information about the wp-trac mailing list