[buddypress-trac] [BuddyPress Trac] #9270: Returns false when it should return an empty array.

buddypress-trac noreply at wordpress.org
Fri Feb 14 12:38:10 UTC 2025


#9270: Returns false when it should return an empty array.
----------------------------+-----------------------------
 Reporter:  alexanderwbell  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Activity        |    Version:  14.3.2
 Severity:  minor           |   Keywords:  needs-patch
----------------------------+-----------------------------
 When the activity item was cached and has no comments, we still need to
 return an empty array, just like how the rest of the function returns an
 empty array when there are no comments. Other functions depend on this
 being the case. For example, line 2618 in bp-activity-template.php in the
 function bp_activity_get_comment_depth will throw an error if this is not
 the case. We could also set bp_activity_get_comment_depth to check if
 $comments returned is false in that function and set it to an empty array.

 But in this version, we return $comments (which is an empty array) instead
 of false on line 1649 (I believe) of class-bp-activity-activity.php in the
 public static function get_activity_comments.


                 if ( 'none' === $comments_cache ) {
                         return false;
 }
 Should I believe be:

 if ( 'none' === $comments_cache ) {
                         return $comments;
 }

 Or we should check in
 bp_activity_get_comment_depth
 If the returned $comments is false and set it to an array.

 Check github pull request.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/9270>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list