I also followed this: https://codex.bbpress.org/getting-started/installing-bbpress/deleting-bbpress/
and get the same fatal error:
Fatal error: Uncaught Error: Cannot unset string offsets
in /hsphere/local/home/audax/dev1.audax.org.au/wp-includes/class-wp-role.php on line 75
Call stack:
WP_Role::remove_cap()
wp-content/plugins/bbpress/includes/core/capabilities.php:240
bbp_remove_caps()
wp-content/plugins/bbpress/includes/admin/tools/reset.php:262
bbp_admin_reset_database()
wp-content/plugins/bbpress/includes/admin/tools/reset.php:100
bbp_admin_reset_handler()
wp-includes/class-wp-hook.php:287
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:311
WP_Hook::do_action()
wp-includes/plugin.php:478
do_action()
wp-admin/admin.php:232
require_once()
wp-admin/tools.php:40
Here is the debug log:
[21-May-2020 04:26:20 UTC] PHP Fatal error: Uncaught Error: Cannot unset string offsets in /hsphere/local/home/somewhere/somewhere/wp-includes/class-wp-role.php:75
Stack trace:
#0 /hsphere/local/home/somewhere/somewhere/wp-content/plugins/bbpress/includes/core/capabilities.php(240): WP_Role->remove_cap(‘spectate’)
#1 /hsphere/local/home/somewhere/somewhere/wp-includes/class-wp-hook.php(287): bbp_remove_caps(”)
#2 /hsphere/local/home/somewhere/somewhere/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array)
#3 /hsphere/local/home/somewhere/somewhere/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#4 /hsphere/local/home/somewhere/somewhere/wp-content/plugins/bbpress/includes/core/sub-actions.php(40): do_action(‘bbp_deactivatio…’)
#5 /hsphere/local/home/somewhere/somewhere/wp-includes/class-wp-hook.php(287): bbp_deactivation(false)
#6 /hsphere/local/home/somewhere/somewhere/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array)
#7 /hsphere/local/home/somewhere/somewhere/wp-include in /hsphere/local/home/somewhere/somewhere/wp-includes/class-wp-role.php on line 75
hmmm…not seen this before, did it deactivate?
No.
I’m on WordPress 5.4.1
so it repeats this error each time you try ?
correct.
I have 3 instances (dev, test & production)
Tried multiple times on all three (not multisite)
Errors were consistent
I used the Members plugin to check the roles.
All the bbPress roles are read-only.
(As administration I was unable to edit them)
Is that correct?
ok, it is a site specific issue, and might (or might not) be related to the members plugin -I have no idea how that plugin works or how you view roles using it.
so all I can say is it could be a theme or plugin issue
Themes
As a test switch to a default theme such as twentytwenty, and see if this fixes.
Plugins
If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.
Then come back
Changed theme to twentytwenty
Deactivated all plugins apart from bbpress
Then tried to deactivate bbPress last … same error.
Note, the Membership plugin was uninstalled earlier.
hmmm… suspect that members may have left something
do you have FTP?
This was occurring before Members was installed.
I only loaded Members to see further inside users, roles and capabilities as native WordPress offers little capability of diagnosing such issues.
Happy to give you access.
How do I pm you?
sorry, I’m just a bbpress user who helps out here, in 5 years, I’ve not seen this issue.
I’d suggest that you just delete the plugin using FTP.
I will delete the folder, then re-install it to then see if I can uninstall it correctly.
thanks
Hi Robin,
Deleted the bbPress folder.
Plugin screen came up fine and stated bbPress was gone.
Reinstalled bbPress
Same issue.
It looks like it fails when attempting to remove ‘spectate’
See log above: WP_Role->remove_cap(‘spectate’)
I was surprised as an Administrator, all the bbPress roles were read-only.
Is that normal?
As an Admin are your bbPress roles read-only?
no, I think that is probably the core of the problem.
basically capabilities are stored against each role in the database in the wp_options table in the database under name wp_user_roles.
Each role is stated, and then it’s capabilities are stored against it.
bbpress is trying to remove roles/capabilities from each bbpress role, and is failing.
maybe if you look in the database and see what bbpress roles you have – if none, then there is nothing for bbpress to do, and that may be why it is erroring
I have already checked, they are definitely in the wp_options table.
I will back-up as well as think of a way to ‘safely’ change things in that space without locking myself out.
thanks
given that you don’t have bbpress running (ie you’ve deleted the folder), then nothing will use those roles and capabilities, so I suspect there is no harm in just leaving them.
The alternate is to create another vanilla worpress site, and that will then have all the worpdress roles in the wp-options entry.
You can then use phpmyadmin to copy the existing entry from the problem site to a txt file (so you have it saved), and then copy the new site entry into it’s place.
Then that entry will have all it should.
Hi Robin,
Definitely something weird going on with roles & capabilities.
Ended up:
1. removing all forum entries
2. delete bbPress plugin folder
Not the best way to remove a plugin, but all seems OK
thank you
ok, thanks for update and hope all ok now 🙂