[buddypress-trac] [BuddyPress Trac] #9010: PHP Fatal error: Uncaught TypeError: Illegal offset type in /buddypress/bp-activity/bp-activity-functions.php:798

buddypress-trac noreply at wordpress.org
Thu Nov 9 05:32:59 UTC 2023


#9010: PHP Fatal error: Uncaught TypeError: Illegal offset type in /buddypress/bp-
activity/bp-activity-functions.php:798
--------------------------+-----------------------
 Reporter:  btwebdesign   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  11.5.0
Component:  Activity      |     Version:  11.3.2
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+-----------------------
Changes (by imath):

 * keywords:  needs-testing => needs-patch


Comment:

 After looking more into it. This can only happen when a plugin or some
 custom code is filtering the `bp_has_activities()` action argument and
 returns an array of activity actions (or types).

 Here's an example of such a filter.

 {{{
 function my_custom_bp_activity_types( $args ) {
         $args['action'] = array( 'new_blog_post', 'new_blog_comment' );
         return $args;
 }
 add_filter( 'bp_after_has_activities_parse_args',
 'my_custom_bp_activity_types', 1 );
 }}}

 Although it cannot be caused by BuddyPress itself and doesn't seem to be
 on us to fix this at first sight, when we look at the inline comment for
 the `bp_has_activities()` function we wrote:

 {{{
  *     @type string|array|bool $action           Filters by the `type`
 column in the database, which is a string
  *                                               categorizing the activity
 item (eg, 'new_blog_post', 'created_group').
  *                                               Accepts a comma-delimited
 string or an array of types. Default: false.

 }}}

 Meaning we support passing an array of activity types. So we need to fix
 it, and we'll do!

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/9010#comment:7>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list