[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
Tue Dec 2 21:47:07 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:  Future Release
Component:  Networks and Sites  |     Version:  trunk
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  multisite
--------------------------------+-----------------------------
Changes (by jeremyfelt):

 * milestone:  Awaiting Review => Future Release


Comment:

 This is great @nerrad, thanks! We should hold on this for now, but get it
 in as soon as the 4.2 cycle starts.

 A couple notes:

 * Is there an opportunity for us to change the response to `false` if an
 invalid ID is passed? The current behavior is `http://` rather than an
 empty string, so we're breaking a bit anyway.
 * I'm a little wary of the ternary, but it's likely ok to leave.
 * Let's split the unit test into two. One with a valid ID, one with an
 invalid ID. We definitely don't need a new site via factory and the
 invalid test. We can probably get away without one in the valid test as
 well and just use `1` as the ID.
 * It's also ugly that `http://` is hardcoded here, but that may be for
 another ticket.

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


More information about the wp-trac mailing list