[buddypress-trac] [BuddyPress Trac] #7580: PHP Warning: Illegal offset type in wp-content/plugins/buddypress/bp-activity/bp-activity-functions.php on line 734
buddypress-trac
noreply at wordpress.org
Mon Aug 7 12:32:54 UTC 2017
#7580: PHP Warning: Illegal offset type in wp-content/plugins/buddypress/bp-
activity/bp-activity-functions.php on line 734
--------------------------+-----------------------------
Reporter: magland | Owner:
Type: defect (bug) | Status: new
Priority: low | Milestone: Awaiting Review
Component: Activity | Version: 2.9.0
Severity: minor | Keywords: needs-patch
--------------------------+-----------------------------
PHP Warning: Illegal offset type in wp-content/plugins/buddypress/bp-
activity/bp-activity-functions.php on line 734
I believe there is a syntax error in the below function causing the above
PHP warning.
{{{#!php
<?php
function bp_activity_post_type_get_tracking_arg( $activity_type, $arg = ''
) {
if ( empty( $activity_type ) || empty( $arg ) ) {
return false;
}
$bp = buddypress();
// Set the activity track global if not set yet
if ( empty( $bp->activity->track ) ) {
$bp->activity->track = bp_activity_get_post_types_tracking_args();
}
if ( isset( $bp->activity->track[ $activity_type ]->{$arg} ) ) {
return $bp->activity->track[ $activity_type ]->{$arg};
} else {
return false;
}
}
}}}
$activity_type is an array not a string so the square brackets look to be
in the wrong place. Suggested fix below:
{{{#!php
<?php
function bp_activity_post_type_get_tracking_arg( $activity_type, $arg = ''
) {
if ( empty( $activity_type ) || empty( $arg ) ) {
return false;
}
$bp = buddypress();
// Set the activity track global if not set yet
if ( empty( $bp->activity->track ) ) {
$bp->activity->track =
bp_activity_get_post_types_tracking_args();
}
if ( isset( $bp->activity->track[ $activity_type->{$arg}] ) ) {
return $bp->activity->track[ $activity_type->{$arg}];
} else {
return false;
}
}
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7580>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list