[buddypress-trac] [BuddyPress] #5083: Activity Meta doesn't recognize 0 as a valid value

buddypress-trac noreply at wordpress.org
Tue Jul 2 16:12:06 UTC 2013

#5083: Activity Meta doesn't recognize 0 as a valid value
 Reporter:  saurabhshukla  |       Owner:  saurabhshukla
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Core           |     Version:
 Severity:  normal         |  Resolution:  invalid
 Keywords:  dev-feedback   |

Comment (by saurabhshukla):

 I'm not the one using a check. BuddyPress checks for empty($activity_meta)
 and hence I can't use 0 as a value for meta. As soon as I get my hands off
 rtMedia, I'll submit a patch.

 in function bp_activity_update_meta() in bp-activity-functions.php

 if ( empty( $meta_value ) )
                 return bp_activity_delete_meta( $activity_id, $meta_key );

 should've been

 if ( $meta_value===false )
                 return bp_activity_delete_meta( $activity_id, $meta_key );


 If I try and store 0 as a value, the key gets deleted, offsetting the
 architecture of the code that I'm trying to write.

 In fact, I don't see the sense in this code, even with the strict
 comparison. If I pass a false value for a meta (which could also be
 legitimate), the key itself gets deleted.

 Hope, I've come across more clearly this time.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5083#comment:3>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list