Skip to:
Content

BuddyPress.org

Opened 10 months ago

Last modified 10 months ago

#8240 new defect (bug)

Data handling issue with `BP_Akismet::get_activity_history()`

Reported by: stephdau Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: (not sure) Keywords:
Cc: webmasterfreya

Description

In https://wordpress.org/support/topic/buddypress-activity-and-akismet/, a BP / Akismet user is reporting some warnings being displayed oin screen as a result of BP_Akismet::get_activity_history():

Warning: usort() expects parameter 1 to be array, string given in …/httpdocs/wp-content/plugins/buddypress/bp-activity/classes/class-bp-akismet.php on line 660

It seems the user is getting $history as not === false, but not in the expected array format usort() can deal with after.

I will ask the user if he can comment here with maybe some data examples, var_dump() samples, etc..

Change History (5)

#2 @webmasterfreya
10 months ago

  • Cc webmasterfreya added

Hi,

The problem occured 3 month ago.

See https://buddypress.org/support/topic/buddypress-activity-and-akismet/
WP 5.3
Buddypress 5.0.0.
BP legacy
php 7.3.11

I posted this with Buddypress and Akismet and Akismet replied (buddypress did not).
I deactivated Akismet until today when I received response from Akismet (Stephane).

So to gather more info I reactivated Akismet and low and behold, the problem seems to be gone.

Current versions :
Wordpress 5.3.2
Akismet 4.1.3
Buddypress 5.1.2
php 7.3.14

So I’m not able to recreate the usort error anymore.

#3 follow-up: @johnjamesjacoby
10 months ago

BuddyPress does not use register_meta() (yet).

Simply casting this variable as an array is enough to safely prevent this notice until all meta data can be properly registered.

#4 @webmasterfreya
10 months ago

O dear,

Can't see the rror anymore in the dashboard, but the error log says otherwise:

[Thu Feb 20 18:36:48.098010 2020] [proxy_fcgi:error] [pid 29585] [client 213.73.155.194:43842] AH01071: Got error 'PHP message: PHP Warning: usort() expects parameter 1 to be array, string given in /var/www/vhosts/freya.nl/httpdocs/wp-content/plugins/buddypress/bp-activity/classes/class-bp-akismet.php on line 660', referer: https://www.freya.nl/wp-admin/admin.php?page=bp-activity
[Thu Feb 20 18:40:49.720092 2020] [proxy_fcgi:error] [pid 30377] [client 213.73.155.194:45238] AH01071: Got error 'PHP message: PHP Warning: usort() expects parameter 1 to be array, string given in /var/www/vhosts/freya.nl/httpdocs/wp-content/plugins/buddypress/bp-activity/classes/class-bp-akismet.php on line 660', referer: https://www.freya.nl/wp-admin/admin.php?page=bp-activity
[Thu Feb 20 18:41:07.921072 2020] [proxy_fcgi:error] [pid 30159] [client 213.73.155.194:45388] AH01071: Got error 'PHP message: PHP Warning: usort() expects parameter 1 to be array, string given in /var/www/vhosts/freya.nl/httpdocs/wp-content/plugins/buddypress/bp-activity/classes/class-bp-akismet.php on line 660', referer: https://www.freya.nl/wp-admin/admin.php?page=bp-activity
[Thu Feb 20 18:42:10.717108 2020] [proxy_fcgi:error] [pid 29585] [client 213.73.155.194:45580] AH01071: Got error 'PHP message: PHP Warning: usort() expects parameter 1 to be array, string given in /var/www/vhosts/freya.nl/httpdocs/wp-content/plugins/buddypress/bp-activity/classes/class-bp-akismet.php on line 660', referer: https://www.freya.nl/wp-admin/admin.php?page=bp-activity

#5 in reply to: ↑ 3 @stephdau
10 months ago

Replying to johnjamesjacoby:

BuddyPress does not use register_meta() (yet).

Simply casting this variable as an array is enough to safely prevent this notice until all meta data can be properly registered.

That would indeed do the trick.

Note: See TracTickets for help on using tickets.