Opened 5 years ago
Closed 3 years ago
#8240 closed defect (bug) (worksforme)
Data handling issue with `BP_Akismet::get_activity_history()`
Reported by: | stephdau | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | (not sure) | Keywords: | reporter-feedback |
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 (7)
#2
@
5 years 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:
↓ 5
@
5 years 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
@
5 years 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
@
5 years 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.
Code is here: https://buddypress.trac.wordpress.org/browser/trunk/src/bp-activity/classes/class-bp-akismet.php?rev=11950#L654