MyBB Community Forums

Full Version: php8.2 errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have just ressurected a dormant forum. It was running 1.8.30 on php 7.3 and the server now runs php8.2 by default. I upgraded the forum to 1.8.38 but got quite a few error messages. 

A couple were from plugins that I simply removed as unneeded, but lots of the errors seem to be from core files.

Everything is fine if I switch to php7.4 but php8.0 or newer gets me these errors:

Warning [2] Undefined property: MyLanguage::$today_rel - Line: 476 - File: inc/functions.php PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/inc/functions.php	476	errorHandler->error_callback
/global.php	490	my_date
/index.php	18	require_once
Warning [2] Undefined property: MyLanguage::$confirm_title - Line: 14 - File: global.php(958) : eval()'d code PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/global.php(958) : eval()'d code	14	errorHandler->error_callback
/global.php	958	eval
/index.php	18	require_once
Warning [2] Undefined property: MyLanguage::$expcol_collapse - Line: 15 - File: global.php(958) : eval()'d code PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/global.php(958) : eval()'d code	15	errorHandler->error_callback
/global.php	958	eval
/index.php	18	require_once
Warning [2] Undefined property: MyLanguage::$expcol_expand - Line: 16 - File: global.php(958) : eval()'d code PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/global.php(958) : eval()'d code	16	errorHandler->error_callback
/global.php	958	eval
/index.php	18	require_once
Warning [2] Undefined property: MyLanguage::$bottomlinks_markread - Line: 15 - File: global.php(1070) : eval()'d code PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/global.php(1070) : eval()'d code	15	errorHandler->error_callback
/global.php	1070	eval
/index.php	18	require_once
Warning [2] Undefined property: MyLanguage::$expcol_collapse - Line: 447 - File: inc/functions_forumlist.php PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/inc/functions_forumlist.php	447	errorHandler->error_callback
/inc/functions_forumlist.php	163	build_forumbits
/index.php	463	build_forumbits
Warning [2] Undefined property: MyLanguage::$expcol_collapse - Line: 447 - File: inc/functions_forumlist.php PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/inc/functions_forumlist.php	447	errorHandler->error_callback
/inc/functions_forumlist.php	163	build_forumbits
/index.php	463	build_forumbits
Warning [2] Undefined property: MyLanguage::$expcol_collapse - Line: 447 - File: inc/functions_forumlist.php PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/inc/functions_forumlist.php	447	errorHandler->error_callback
/inc/functions_forumlist.php	163	build_forumbits
/index.php	463	build_forumbits
Warning [2] Undefined property: MyLanguage::$expcol_collapse - Line: 447 - File: inc/functions_forumlist.php PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/inc/functions_forumlist.php	447	errorHandler->error_callback
/index.php	463	build_forumbits
Warning [2] Undefined property: MyLanguage::$forum_closed - Line: 26 - File: index.php(468) : eval()'d code PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/index.php(468) : eval()'d code	26	errorHandler->error_callback
/index.php	468	eval
Warning [2] Undefined property: MyLanguage::$forum_closed - Line: 27 - File: index.php(468) : eval()'d code PHP 8.0.30 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/index.php(468) : eval()'d code	27	errorHandler->error_callback
/index.php	468	eval

Has the upgrade not gone properly, or is something else wrong? I could run it on php7.4 but I'd prefer not to.

Any suggestions?
please check if there are templates which are not updated

ACP --> Templates --> Find Updated Templates

then update them
(2024-05-14, 12:59 PM)bv64 Wrote: [ -> ]please check if there are templates which are not updated

ACP --> Templates --> Find Updated Templates

then update them

Thanks for the suggestion. There were some changes to update, but the outcome was no change at all. 

There were several thrmes and templates not being used, so I deleted them. Still no joy.

The issues seem to be around languages files, and in particular, admin/modules/config/languages.php The file timestamp is the same as all the other new files. Despite this, I tried re-uploading that individual file again. Same file size, same problem.

Later (much later!):

After much messing about I decided that the problem was with missing language definition strings. After a while trying to add them in, I decided that this was an uphill battle and decided to abandon the language files, reverting to the default English (American)

And it worked!

/modules/config/languages.php
you are right! I thought this were old language variables, which no longer are used by mybb

didn't check, my error, sorry

but why did they miss?
I think that the problems are that php8 and higher are more picky about using variables that haven't already been defined. Although it is now mostly working, it's not perfect, so I'm back to php7.4 for now. With 8.2 I get:

Warning [2] Undefined array key "showimages" - Line: 813 - File: inc/functions_post.php PHP 8.2.18 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/functions_post.php 813 errorHandler->error_callback
/announcements.php 102 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 818 - File: inc/functions_post.php PHP 8.2.18 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/functions_post.php 818 errorHandler->error_callback
/announcements.php 102 build_postbit

I also had a problem logging in to the admin. It turned out that the problem was that the admin sessions table had a session useragent field that was set to varchar 100. My browser useragent string is 111 characters long.

Changed it to varchar 200 and so far, all is well, using php 7.4
maybe you found a unknown issue on announcements.php

You can deactivate the display of warnings in the acp
ACP --> Server & Optimization Options --> Error Type Medium --> Choose "Errors"

I don't know, why the useragent field was only 100 characters long, on standard mybb it is 200