BuddyDev

Search

buddypress clear notifications throwing PHP warning

  • Participant
    Level: Initiated
    Posts: 1
    Matt Kepnes on #47977

    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:267

    We 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

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #47986

    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.php

    The code is working for BuddyPress as it gets an array of notifications.

    I will check the BuddyBoss implementation and update you by tomorrow.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #48009

    Hi 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#L215

    The 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#L243

    Please report the bug to BuddyBoss team. They should be able quickly fix it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Matt Kepnes on #48114

    Thanks, Brajesh. I’ll take it up with them. Appreciate your time.

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #48124

    Thank you Matt

You must be logged in to reply to this topic.

This topic is: not resolved