MyBB Community Forums

Full Version: [PHP 8.0/8.1] Online/Offline Status and Last visit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello everyone!

I changed the PHP version on my server to 8.0/8.1. After the change on my test forum, the online status does't work and the time of the last visit does not update. On PHP 7.4 it's ok. Server logs say nothing.

This is a MyBB bug?
Go to ACP > Configuration > Server and Optimization Options > Error Logging Medium > set this to log and email errors, make sure Error Type Medium is set to Warnings and Errors. There will be an error generated on the page, possibly from the theme, causing this issue.
I don't see any errors. This problem is with the default theme.
There will be an error somewhere, check the error log and your email.
I chose "Log and email errors" but still no errors on error.log.
Just to be precise, I currently have MyBB 1.8.33 and PHP 8.1.12.
PM me FTP login details and I will find the error for you.
I wrote above that the error occurs on my test forum (localhost). So I am unable to provide you with login details.

I'm writing about this bug because a few users had this problem in the past, and now bartosh noticed it.
Link to the thread: MyBB 1.8.33 wydane
Yes, we are aware of what the issue is. As explained, a PHP error or warning is being generated, and it prevents some shutdown queries from running, which means things like thread views and online status do not update. Those features themselves are not broken, the issue is a PHP error preventing shutdown code from running. Hence, you need to find what the error is to be able to fix it. It could be from a plugin, from the theme, from a language pack, or elsewhere.

If you are unable to debug why your forum is not writing an error log, then edit inc/functions.php, and around line 145:

if($done_shutdown == true || !$config || (isset($error_handler) && $error_handler->has_errors))

before this, add this:

echo $error_handler->show_warnings();

or:

print_r($error_handler->warnings);
The problem is still that no error log appears. I tried with two your PHP codes.

I'm using the default theme and I don't have any plugins. I bet the problem is in the theme itself or in some MyBB file.
I can 100% guarantee you there will be an error generated somewhere, I've dealt with several of these threads recently, I can assure you I know what the problem is Smile You may be using the default theme, but if it has had modified templates in the past, there may be undefined variables in a template.

Again line 145 of inc/functions.php:

if($done_shutdown == true || !$config || (isset($error_handler) && $error_handler->has_errors))

change this to:

if($done_shutdown == true || !$config)

After this change, does the functionality start working again?
Pages: 1 2