We are doing some auditing on our site coding pending a PHP update and noticed the plugin throwing a PHP warning.
count(): Parameter must be an array or an object that implements Countable
and
wp-content/plugins/bp-clear-notifications/bp-clear-notifications.php:134
Clear_BP_Notifications_Helper->add_notification_for_wp()
wp-includes/class-wp-hook.php:308
do_action_ref_array(‘admin_bar_menu’)
wp-includes/admin-bar.php:95
wp_admin_bar_render()
wp-includes/class-wp-hook.php:308
do_action(‘in_admin_header’)
wp-admin/admin-header.php:267We do run the plugin with Buddyboss, but we are unsure if that’s the cause or not. Can anybody advise if there is a fix for this?
Thanks
Hi Matt,
Thank you for reporting the issue.It seems BuddyBoss has changed their API and instead of array it is returning something else.
https://github.com/sbrajesh/bp-clear-notifications/blob/master/bp-clear-notifications.phpThe code is working for BuddyPress as it gets an array of notifications.
I will check the BuddyBoss implementation and update you by tomorrow.
Regards
BrajeshHi Matt,
Thank you for your patience.There is a bug in BuddyBoss causing this
Here is the where the bug is
https://github.com/buddyboss/buddyboss-platform/blob/release/src/bp-notifications/bp-notifications-functions.php#L215The bug is that instead of collecting the rendered data as array they are mutating it.
Here is how BuddyPress handles the same.
https://github.com/buddypress/buddypress/blob/master/src/bp-notifications/bp-notifications-functions.php#L243Please report the bug to BuddyBoss team. They should be able quickly fix it.
Regards
BrajeshThanks, Brajesh. I’ll take it up with them. Appreciate your time.
You must be logged in to reply to this topic.