PHP Error when deactivating any plugin

When deactivating any plugin from my MainWP Dashboard site, I get this PHP error in my server logs and the site goes to a critical error mode:

Dec 10 22:59:00 [Sun Dec 11 06:59:00.435433 2022] [php:error] [pid 83] [client 207.216.93.172:40726] PHP Fatal error: Uncaught TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given in /app/data/public/wp-includes/l10n.php:229\nStack trace:\n#0 /app/data/public/wp-includes/l10n.php(229): strrpos()\n#1 /app/data/public/wp-includes/l10n.php(1351): before_last_bar()\n#2 /app/data/public/wp-content/plugins/mainwp-child/class/class-mainwp-utility.php(903): translate_user_role()\n#3 /app/data/public/wp-content/plugins/mainwp-child/class/class-mainwp-child-actions.php(674): MainWP\\Child\\MainWP_Utility->get_roles()\n#4 /app/data/public/wp-content/plugins/mainwp-child/class/class-mainwp-child-actions.php(442): MainWP\\Child\\MainWP_Child_Actions->save_actions()\n#5 [internal function]: MainWP\\Child\\MainWP_Child_Actions->callback_deactivate_plugin()\n#6 /app/data/public/wp-content/plugins/mainwp-child/class/class-mainwp-child-actions.php(150): call_user_func_array()\n#7 /app/data/public/wp-includes/class-wp-hook.php(308): MainWP\\Child\\MainWP_Child_Actions->callback()\n#8 /app/data/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()\n#9 /app/data/public/wp-includes/plugin.php(517): WP_Hook->do_action()\n#10 /app/data/public/wp-admin/includes/plugin.php(775): do_action()\n#11 /app/data/public/wp-admin/plugins.php(209): deactivate_plugins()\n#12 {main}\n thrown in /app/data/public/wp-includes/l10n.php on line 229, referer: https://mainwp.d19.ca/wp-admin/plugins.php

Any ideas how to fix this? I restored from a backup from 2 weeks ago but the issue still remains too.

I’m using the latest versions of MainWP Dashboard & Client plugins, and running WordPress 6.1.1 and PHP 8.1.

1 Like

The latest versions of MainWP (Dashboard and Child) are 4.3.1 (still in beta), which should give you PHP 8.1 compatibility. For oolder versions you should use PHP 8.0. But I can recommend the beta version, as it doesn’t give me any errors.
Please check this post for the beta version:

Good idea but I just tried updating to the 4.3.1 beta but there is no change in behaviour.

Interestingly it seems the issue occurs after clearing the redis object database cache, so it may have been working all this time for me only because it was reading from cache, but when the cache is cleared that’s when these PHP errors occur. In other words it may have broken quite a while ago but didn’t show until I had cleared the redis cache.

The PHP error indicates this but I had a chance to disable the MainWP Child plugin (4.3.1-beta1) and then I cleared the redis storage cache and it was fine to disable all other plugins, so the root cause definitely seems to be with the MainWP Child plugin.

Hey @d19dotca

Thank you for reporting this to us.

Can you please try this version of the MainWP Child plugin and see if it fixes the issue? Dropbox - mainwp-child.zip - Simplify your life

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.