Hi @joewa1980
thank you for reporting this issue.
I don’t think this fatal error is related to PHP 8.1.
The fatal error is surely caused by FDP, but only because it calls the function sanitize_file_name, which is a WordPress core function.
That function calls other functions, and when wp_get_current_user is called, you have the fatal error, because it doesn’t exist at the point of the WP flow where it’s called.
I suspect the error is triggered when FDP calls sanitize_file_name for requests that are not normal page loads. Do you maybe use WP CLI?
If you can find the situation that triggers the fatal error it would be great.
In any case, here you will find version 1.8.9.3-beta.1 that should fix this problem: https://downloads.wp.xz.cn/plugin/freesoul-deactivate-plugins.1.8.9.3-beta.1.zip
Would it be possible for you to test it? It should not give problems, the only difference with the official version is the replacement of sanitize_file_name with a function provided by FDP. I’ve done some tests and it seems it doesn’t create issues, but if you test the beta version, have a look at the pages where you have deactivated plugins with the Singles settings.
Let me know if you still have the same fatal error in the log file if you try 1.8.9.3-beta.1.
Thread Starter
Joe
(@joewa1980)
Thanks for your quick work on this @giuse – we’ve installed it and will give it some time to see how our users interact with the site, and attempt to monitor what’s happening.
Thread Starter
Joe
(@joewa1980)
3hrs later and we’ve seen several instances of the error show up unfortunately.
I suspect the error is triggered when FDP calls sanitize_file_name for requests that are not normal page loads. Do you maybe use WP CLI?
– I don’t use WP CLI.
– Could you think of what “requests that are not normal page loads” might be?
We have almost the same setup (plugins, theme, snippets, settings) on another website for a different geographical market and don’t see the same error, so your comment about it not being a PHP 8.1 fault seems correct. I don’t know what is different on site 1 that is causing this!
Thread Starter
Joe
(@joewa1980)
Unrelated to the above issue, but a PHP 8.1 PHP warning for you:
PHP Warning: Undefined variable $loc in /mywebsite.com/wp-content/plugins/freesoul-deactivate-plugins/admin/templates/pages/eos-dp-terms-archive.php on line 84
Hi @joewa1980
really sorry. I’ve uploaded the wrong mu-plugin. Version 1.8.9.3-beta.1 still had the function sanitize_file_name instead of that one provided by FDP.
Now you have the right one, you should download 1.8.9.3-beta.2 https://downloads.wp.xz.cn/plugin/freesoul-deactivate-plugins.1.8.9.3-beta.2.zip. It fixes also the PHP warning “Undefined variable $loc…”. Also, this last warning didn’t depend on PHP 8. You had it also with older PHP versions.
If you don’t use WP CLI, maybe they are Ajax requests that don’t call the file wp-admin/admin-ajax.php, or maybe Rest API requests to URLs like https://your-domain.com/wp-json/…
Thread Starter
Joe
(@joewa1980)
That’s great – I’ll let you know how it goes, I’m sure it’ll be fine.
Thank you Joe. If you want you can update to the official version 1.8.9.3.
I wasn’t able to reproduce the same issue, but because it’s a fatal error I preferred to publish the new version with the fix.
@joewa1980
Thread Starter
Joe
(@joewa1980)
Thanks for the quick work @giuse! We’ve not seen the fatal error since installing the new version.
perfect! Many thanks for the confimration.
Have a great day
Jose
@joewa1980