MyBB Community Forums

Full Version: Error after upgrading to PhP 8
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello, 

I also have errors on my forum when I upgrade to PhP 8.
Here are the errors displayed at the top of the forum:

Quote: The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 50 - File: global.php(961) : eval()'d code PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/global.php(961) : eval()'d code 50 errorHandler->error_callback
/global.php 961 eval
/index.php 18 require_once
Warning [2] Undefined variable $ps_header_index - Line: 16 - File: index.php(468) : eval()'d code PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/index.php(468) : eval()'d code 16 errorHandler->error_callback
/index.php 468 eval
Warning [2] Undefined variable $dvz_shoutbox - Line: 17 - File: index.php(468) : eval()'d code PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/index.php(468) : eval()'d code 17 errorHandler->error_callback
/index.php 468


MyBB version: 1.8.37
Php version was 7, I've tried to update to 8.0, 8.2, 8.3... same errors.
Forum URL:  https://mwrenaissance.info/

I've seen on the forum that this may be caused by old templates, but I'm not very familiar with PhP, templates, etc... How can I fix this? (for now, I reverted to PhP 7)

If I am not logged into the website and using Edge, I see fewer errors:
Quote:Warning [2] Undefined variable $unreadreports - Line: 50 - File: global.php(961) : eval()'d code PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/global.php(961) : eval()'d code 50 errorHandler->error_callback
/global.php 961 eval
/index.php 18 require_once

Thank you for any help.

OK, I found a few related posts, and while I don't understand anything to PhP and forum templates I deleted $unreadreports in the Header of the template, then delete $ps_header_index and  $dvz_shoutbox within index.php... and it seems to work. At least there is no more errors diplayed.

But I got a lot of errors with the "BAM Announcements Manager 2.0" plugin, which does not work any more.
Is there a way to fix this? Or do I have to wait for a plugin update? Switch to another plugin? 

Thank you!

Quote:Warning [2] Undefined variable $activatedImage - Line: 1010 - File: admin/modules/config/bam.php PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/admin/modules/config/bam.php 1010 errorHandler->error_callback
/admin/modules/config/bam.php 848 generate_manage_page
/admin/index.php 830 require

Warning [2] Undefined array key "action" - Line: 1096 - File: admin/modules/config/bam.php PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/admin/modules/config/bam.php 1096 errorHandler->error_callback
/admin/modules/config/bam.php 1040 generate_announcement_controls
/admin/modules/config/bam.php 848 generate_manage_page
/admin/index.php 830 require

Warning [2] Undefined array key "action" - Line: 1107 - File: admin/modules/config/bam.php PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/admin/modules/config/bam.php 1107 errorHandler->error_callback
/admin/modules/config/bam.php 1040 generate_announcement_controls
/admin/modules/config/bam.php 848 generate_manage_page
/admin/index.php 830 require

Warning [2] Undefined array key "action" - Line: 1119 - File: admin/modules/config/bam.php PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/admin/modules/config/bam.php 1119 errorHandler->error_callback
/admin/modules/config/bam.php 1040 generate_announcement_controls
/admin/modules/config/bam.php 848 generate_manage_page
/admin/index.php 830 require

Warning [2] Undefined variable $count_deactivated - Line: 1050 - File: admin/modules/config/bam.php PHP 8.3.1 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/admin/modules/config/bam.php 1050 errorHandler->error_callback
/admin/modules/config/bam.php 848 generate_manage_page
/admin/index.php 830 require

It is possible to fix this?

New error discovered:

When opening a forum thread, I get the following error:

Quote:The following warnings occurred:
Warning [2] Undefined variable $codebutquick - Line: 31 - File: showthread.php(1308) : eval()'d code PHP 8.3.1 (Linux)

Where is $codebutquick? How can I delete it?

I also have a lot of errors like this one:

Quote:Warning [2] Undefined variable $lastposttime - Line: 33 - File: forumdisplay.php(1393) : eval()'d code PHP 8.3.1 (Linux)
you shouldn't delete these variables like a wild man, that's not a solution to the problem

$unreadreports must be replaced by $modnotice and must not be deleted, otherwise the mods will no longer receive the message in the header when someone has reported something!

A lot of outdated plugins that cause further warnings, please check the relevant support threads to see if there are already solutions

You can deactivate the display of warnings in the forum in the ACP
ACP --> Configuration --> Server & Optimization

Everything still works with warnings, but something doesn't work until error

Stay calm and work through it little by little!
Thanks for your explanation.

For "ps_header_index" and "$dvz_shoutbox", should I also replace them?
i don't know ps_header_index, I think it's from a plugin, this will not work without

with deleting $dvz_shoutbox you have killed your shoutbox; maybe you don't want it any longer Wink
(2024-01-25, 06:14 AM)bv64 Wrote: [ -> ]i don't know ps_header_index, I think it's from a plugin, this will not work without

with deleting $dvz_shoutbox you have killed your shoutbox; maybe you don't want it any longer Wink

Understood, but never mind, I do not use shoutbox.
I disabled a plugin that was causing errors... but I wanted to use it  Confused

On several pages, I also have many errors with $lastposttime:

Quote:Warning [2] Undefined variable $lastposttime - Line: 33 - File: forumdisplay.php(1393) : eval()'d code PHP 8.3.1 (Linux)
please post a list of plugins you use, maybe someone can see to which plugin the individual warnings belong

there are solutions for a lot of plugins, maybe for some of yours, so search the board for single warnings

and please check the templates

ACP --> Templates --> Find Updated Templates

Since we had the $modnotice problem, more templates could be out of date.

Templates are only updated if they are in their original condition during update process

The $modnotice change was 1.8.20, a long long time ago!

so, I have to work now for a while Wink

(2024-01-24, 11:43 PM)Mordicus Wrote: [ -> ]Where is $codebutquick? How can I delete it?
This apparently belongs to the “Quick Advanced Editor” plugin, an outdated plugin that is no longer even offered.
So uninstall the plugin

Quote:ps_header_index
belongs to the plugin "ProStats" which doesn't run under PHP8 as far as I know --> uninstall

Quote:I disabled a plugin that was causing errors... but I wanted to use it
which plugin is this?

Quote:$dvz_shoutbox
you wrote you don't use the shoutbox, so uninstall this plugin and remove the $dvz_shoutbox from index-template

Quote:BAM Announcements Manager 2.0
I never used this plugin, so I can't help with it
(2024-01-25, 06:32 AM)bv64 Wrote: [ -> ]please post a list of plugins you use, maybe someone can see to which plugin the individual warnings belong

there are solutions for a lot of plugins, maybe for some of yours, so search the board for single warnings

I have deactivated all the plugins.

Inactivated plugins are:
BAM+ Announcements Manager (2.0)
Image Upload (1.0.3)
imple Image Upload (2.0.1)
Mybb Ncode Image Resizer (1.2)
Spoiler MyCode (1.8.2)

Quote:and please check the templates

ACP --> Templates --> Find Updated Templates
I did if tor the template I use, I reverted a few modified parts to the original.

Quote:Since we had the $modnotice problem, more templates could be out of date.

Templates are only updated if they are in their original condition during update process

The $modnotice change was 1.8.20, a long long time ago!

so, I have to work now for a while Wink
I've contacted the theme author, for him there it is not related to PhP, but he does not know PhP.
I've disabled the plugins, deleted and reinstalled the theme,  "$unreadreports" was back... so I manually replaced it with $modnotice
The theme (igame) is old but was regularly updated.


Quote:
(2024-01-24, 11:43 PM)Mordicus Wrote: [ -> ]Where is $codebutquick? How can I delete it?
This apparently belongs to the “Quick Advanced Editor” plugin, an outdated plugin that is no longer even offered.
So uninstall the plugin
I don't have this plugin installed, but did installed it long time ago... it there a way to clean this kind of residue, leftover?

Quote:
Quote:ps_header_index
belongs to the plugin "ProStats" which doesn't run under PHP8 as far as I know --> uninstall
Not installed. Can I deleted ps_header_index from the template?
And, BTW, where it is exactly? I have trouble to find it...

Quote:
Quote:I disabled a plugin that was causing errors... but I wanted to use it
which plugin is this?
BAM+ Announcements Manager (2.0)
A simple plugin that add a line of coloured text at the top of the forum index.
It is in the list of recommended plugins by MyBB.

I've uninstalled and reinstalled it, I get many errors:

Warning [2] Undefined variable $activatedImage - Line: 1010 - File: admin/modules/config/bam.php PHP 8.3.2 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/admin/modules/config/bam.php	1010	errorHandler->error_callback
/admin/modules/config/bam.php	848	generate_manage_page
/admin/index.php	830	require

Warning [2] Undefined array key "action" - Line: 1096 - File: admin/modules/config/bam.php PHP 8.3.2 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/admin/modules/config/bam.php	1096	errorHandler->error_callback
/admin/modules/config/bam.php	1040	generate_announcement_controls
/admin/modules/config/bam.php	848	generate_manage_page
/admin/index.php	830	require

Warning [2] Undefined array key "action" - Line: 1107 - File: admin/modules/config/bam.php PHP 8.3.2 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/admin/modules/config/bam.php	1107	errorHandler->error_callback
/admin/modules/config/bam.php	1040	generate_announcement_controls
/admin/modules/config/bam.php	848	generate_manage_page
/admin/index.php	830	require

Warning [2] Undefined array key "action" - Line: 1119 - File: admin/modules/config/bam.php PHP 8.3.2 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/admin/modules/config/bam.php	1119	errorHandler->error_callback
/admin/modules/config/bam.php	1040	generate_announcement_controls
/admin/modules/config/bam.php	848	generate_manage_page
/admin/index.php	830	require

Warning [2] Undefined variable $count_deactivated - Line: 1050 - File: admin/modules/config/bam.php PHP 8.3.2 (Linux)
File	Line	Function
/inc/class_error.php	153	errorHandler->error
/admin/modules/config/bam.php	1050	errorHandler->error_callback
/admin/modules/config/bam.php	848	generate_manage_page
/admin/index.php	830	require


Quote:$dvz_shoutbox
you wrote you don't use the shoutbox, so uninstall this plugin and remove the $dvz_shoutbox from index-template[/quote]
I do not see this plugin... May have tried to installed it long long long time ago. Another leftover? Can I clean it? I do not see the plugin anywhere, nothing in inc/plugin folder neither.[/quote]

Thank you very much for your help, it is very appreciated!  Angel
hello again

so let's learn to read such warnings

example:
Quote:The following warnings occurred:
Warning [2] Undefined variable $codebutquick - Line: 31 - File: showthread.php(1308) : eval()'d code PHP 8.3.1 (Linux)
this means: in Line 1308 of showthread.php is a template called
so, let's look at the showthread.php
in original it is this line:
eval("\$quickreply = \"".$templates->get("[color=#005DC2]showthread_quickreply[/color]")."\";");
it is the template showthread_quickreply
in this template in line 31 you will find the variable

You can also do this for other warnings or use the template search function in ACP --> Templates --> Search/Replace to find the variable

Quote:I've disabled the plugins, deleted and reinstalled the theme, "$unreadreports" was back... so I manually replaced it with $modnotice
The theme (igame) is old but was regularly updated.
Apparently the author didn't provide the theme with updates, otherwise the change would have to be there

for BAM... I found this: https://community.mybb.com/thread-159160...pid1382196
so you may ask in this threads and post your warnings. Maybe the author is still active, maybe not.
Quote:it is the template showthread_quickreply
in this template in line 31 you will find the variable

Thank you!
But what can I do once I've found the location in the template? Can I try edit and fix it myself?
if you don't use this plugin, this variable isn't needed and you can delete it

I only can guess why it is there
a) you didn't uninstall this plugin correct
b) the plugin install routine is incorrect
Pages: 1 2