[buddypress-trac] [BuddyPress Trac] #6977: Audit all DB fetch methods to return integers where appropriate

buddypress-trac noreply at wordpress.org
Thu Mar 24 01:34:40 UTC 2016


#6977: Audit all DB fetch methods to return integers where appropriate
---------------------------------+------------------------------
 Reporter:  r-a-y                |       Owner:
     Type:  enhancement          |      Status:  new
 Priority:  normal               |   Milestone:  Awaiting Review
Component:  Component - Any/All  |     Version:
 Severity:  normal               |  Resolution:
 Keywords:  dev-feedback         |
---------------------------------+------------------------------

Comment (by boonebgorges):

 > How are you checking for a failed lookup?  `$f = new
 BP_Friends_Friendship( 0 )`?
 >
 > If so, `$f->initiator_user_id` will always return `null` with or without
 the patch.

 Yeah, or `$f = new BP_Friends_Friendship( $foo )` for some `$foo`
 corresponding to a non-existent friendship. In this specific case, because
 the `get_row()` query will return nothing, fields like `initiator_user_id`
 never get set. So, as you note, it's `null` both before and after the
 patch. I think that's the correct behavior. My point was that we should be
 sensitive to that as we continue to patch these things - don't go casting
 empty results to `0` unless `0` is the semantically correct value.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6977#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list