Opened 11 months ago
Closed 3 weeks ago
#9270 closed defect (bug) (fixed)
Returns false when it should return an empty array.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 15.0.0 | Priority: | normal |
| Severity: | minor | Version: | 14.3.2 |
| Component: | Activity | Keywords: | has-patch |
| Cc: |
Description
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.
Change History (3)
This ticket was mentioned in PR #405 on buddypress/buddypress by Alexanderwbell.
11 months ago
#1
- Keywords has-patch added; needs-patch removed
https://buddypress.trac.wordpress.org/ticket/9270#ticket
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.
Trac ticket: