Skip to:
Content

BuddyPress.org

Opened 3 months ago

Closed 3 months ago

Last modified 2 months ago

#8484 closed enhancement (fixed)

Bug in bp_nouveau_get_activity_entry_buttons function when bp_nouveau_get_activity_entry_buttons filter returns empty array

Reported by: sbrajesh Owned by: imath
Milestone: 9.0.0 Priority: normal
Severity: normal Version: 8.0.0
Component: Core Keywords: has-patch
Cc:

Description

Hi,
There is a bug in bp_nouveau_get_activity_entry_buttons()
When a function hooked to filter 'bp_nouveau_get_activity_entry_buttons' returns an empty array( I was trying to hide the action buttons for an activity when it is under moderation), The function return $buttons incorrectly.

This causes php to throw notice and show Array Array Array where action is expected($buttons is multi dimensional array).

The following line

		if ( ! $buttons_group ) {
			return $buttons;
		}

should be changed to

		if ( ! $buttons_group ) {
			return array();
		}

I am not return $buttons_group as the return expects an array and if some code returns incorrect value type, it will cause issue in future.

Please update.

Attachments (1)

8484.diff​ (579 bytes) - added by sbrajesh 3 months ago.

Download all attachments as: .zip

Change History (6)

@sbrajesh
3 months ago

#1 @imath
3 months ago

  • Milestone changed from Awaiting Review to 8.1.0

Thanks for your report and patch πŸ‘Œ. Let’s include it in next minor release

#2 @sbrajesh
3 months ago

Thank you for considering it.

#3 @imath
3 months ago

In 12970:

BP Nouveau: improve the function to get activity action buttons

Right After the filter 'bp_nouveau_get_activity_entry_buttons' the function was wrongly returning an array that wasn't the result of the filter when this result was empty.

In this particular case, we simply need to return an empty array.

Props sbrajesh

See #8484 (trunk)

#4 @imath
3 months ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 12971:

BP Nouveau: improve the function to get activity action buttons

Right After the filter 'bp_nouveau_get_activity_entry_buttons' the function was wrongly returning an array that wasn't the result of the filter when this result was empty.

In this particular case, we simply need to return an empty array.

Props sbrajesh

Fixes #8484 (branch 8.0)

#5 @imath
2 months ago

  • Milestone changed from 8.1.0 to 9.0.0

Ticket retargeted after milestone deleted

Note: See TracTickets for help on using tickets.