MyBB Community Forums
[Performance] Mybb Php 8.0 - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: [Performance] Mybb Php 8.0 (/thread-230866.html)

Pages: 1 2 3


RE: Mybb Php 8.0 - JimR - 2021-07-01

(2021-07-01, 01:32 PM)Devilshakerz Wrote: Were all the attached errors generated when running 1.8.27? Some of them suggest outdated (or modified) files.

Added some things to investigate in https://github.com/mybb/mybb/issues/4138#issuecomment-872245095

(2021-07-01, 07:47 AM)JimR Wrote: running the admin cp index.php gives the following errors 

[Image: WNQs8LO.png]

does this indicate that the $mybb object is not being created ?

If the file was executed through CLI, that may be normal.

<error>
	<script>showthread.php(1612) : eval()'d code</script>
	<line>46</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Undefined property: MyLanguage::$thread_modes</message>
	<back_trace>#0  errorHandler->error() called at [/showthread.php(1612) : eval()'d code:46]
#1  eval() called at [/showthread.php:1612]
</back_trace>
</error>

This language string was removed in https://github.com/mybb/mybb/pull/4351/files (template needs to be updated)

deleted error.log , copied the changed files for 18.07 to the mybb directory and re ran upgrade.php. attached is the 'new' error log


RE: Mybb Php 8.0 - Devilshakerz - 2021-07-02

Did you mean to attach a new file? The attachments seem to be the same.

You can also run File Verification in the ACP to make sure all files were overwritten correctly.


RE: Mybb Php 8.0 - JimR - 2021-07-03

(2021-07-01, 02:49 PM)JimR Wrote:
(2021-07-01, 01:32 PM)Devilshakerz Wrote: Were all the attached errors generated when running 1.8.27? Some of them suggest outdated (or modified) files.

Added some things to investigate in https://github.com/mybb/mybb/issues/4138#issuecomment-872245095

(2021-07-01, 07:47 AM)JimR Wrote: running the admin cp index.php gives the following errors 

[Image: WNQs8LO.png]

does this indicate that the $mybb object is not being created ?

If the file was executed through CLI, that may be normal.

<error>
	<script>showthread.php(1612) : eval()'d code</script>
	<line>46</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Undefined property: MyLanguage::$thread_modes</message>
	<back_trace>#0  errorHandler->error() called at [/showthread.php(1612) : eval()'d code:46]
#1  eval() called at [/showthread.php:1612]
</back_trace>
</error>

This language string was removed in https://github.com/mybb/mybb/pull/4351/files (template needs to be updated)

deleted error.log , copied the changed files for 18.07 to the mybb directory and re ran upgrade.php. attached is the 'new' error log

my bad added new version of the error log ..
 and cli outputs from php 7.4 & php 8.07 
php 7.4

[Image: 6h1ZZST.png]

php 8.0

[Image: tF0XVLm.png]

as you can see php 7.4 processes the script correctly & php 8.0 does not, there are no errors written to the error log from the admin cp this is due (I guess) to the mybb object not being created  line 176 being 
$mybb->settings['errortypemedium'] = "none";

As a side note I disabled the xthreads plugin, which fails with a few errors, but for some reason mybb is still trying to load xthreads

[Image: JlBtHL6.png]

hope this helps


RE: Mybb Php 8.0 - JimR - 2021-07-05

Just setting up a new copy of mybb using php 8.08
file install/index.php just gives a HTTP error 500
however from the command line it give the following errors, which are the same as in the admin cp from previous posts 
PHP Warning:  Attempt to read property "settings" on null in /var/www/html/mybb27/inc/class_error.php on line 174
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/mybb27/inc/class_error.php on line 174
PHP Fatal error:  Uncaught Error: Attempt to modify property "settings" on null in /var/www/html/mybb27/inc/class_error.php:176
Stack trace:
#0 /var/www/html/mybb27/inc/class_core.php(264): errorHandler->error()
#1 /var/www/html/mybb27/install/index.php(28): MyBB->__construct()
#2 {main}
thrown in /var/www/html/mybb27/inc/class_error.php on line 176


running with php7.4 causes no issues at all, so I am guessing there is an issue there as this is a totally clean install.

UPDATE :-
found one bug in inc/class_core.php line 265 or thereabouts 
 if($_SERVER['REQUEST_METHOD'] == "POST")
                {
                        $this->request_method = "post";
                }
                else if($_SERVER['REQUEST_METHOD'] == "GET")
                {
                        $this->request_method = "get";
                }

change it to
 if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST")
                {
                        $this->request_method = "post";
                }
                else if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "GET")
                {
                        $this->request_method = "get";
                }

the error 500 error is gone.
all the other errors appear to stem from plugins not defining variables so plugin coders may have to use a load of isset's or do a re write of their plugins


RE: Mybb Php 8.0 - Matt - 2021-07-05

These files are not designed to be run from the command line, MyBB expects to be run via a web server so REQUEST_METHOD would normally be set. What's the rationale for running on the command line?


RE: Mybb Php 8.0 - JimR - 2021-07-05

(2021-07-05, 11:35 AM)Matt Wrote: These files are not designed to be run from the command line, MyBB expects to be run via a web server so REQUEST_METHOD would normally be set. What's the rationale for running on the command line?

well it allowed me to correct the isset issue in class_core.php without running from the command line I would have had no clue where to start looking as the browser is just returning the apache default error page

Quote:
#1 /var/www/html/mybb27/install/index.php(28): MyBB->__construct()

took me to the point that the $mybb object was failing which in turn took me to class_core.php with the error
#0 /var/www/html/mybb27/inc/class_core.php(264): errorHandler->error()
 
where I found the issue. adding the adjustments in the previous post I was able to install mybb using php 8.08 as the web browser no longer gave a 500 error and processed as expected

admin cp does not find correct lang string  to fix change 
this block at around line 1930 in admin/modules/config/settings.php

 while($group = $db->fetch_array($query))
                {
                        $group_lang_var = "setting_group_{$group['name']}";
                        if($lang->$group_lang_var)
                        {
                                $group_title = htmlspecialchars_uni($lang->$group_lang_var);
                        }
                        else
                        {
                                $group_title = htmlspecialchars_uni($group['title']);
                        }

                        $group_desc_lang_var = "setting_group_{$group['name']}_desc";
                        if($lang->$group_desc_lang_var)
                        {
                                $group_desc = htmlspecialchars_uni($lang->$group_desc_lang_var);
                        }
                        else
                        {
                                $group_desc = htmlspecialchars_uni($group['description']);
                        }

                        $table->construct_cell("<strong><a href=\"index.php?module=config-settings&amp;action=change&amp;gid={$group['gid']}\">{$group_title}</a></strong> ({$group['settingcount']} {$lang->bbsetti>
                        $table->construct_row();
                }

to 
 while($group = $db->fetch_array($query))
                {
                        $group_lang_var = "setting_group_{$group['name']}";
                        if(isset($lang->$group_lang_var))
                        {
                                $group_title = htmlspecialchars_uni($lang->$group_lang_var);
                        }
                        else
                        {
                                $group_title = htmlspecialchars_uni($group['title']);
                        }

                        $group_desc_lang_var = "setting_group_{$group['name']}_desc";
                        if(isset($lang->$group_desc_lang_var))
                        {
                                $group_desc = htmlspecialchars_uni($lang->$group_desc_lang_var);
                        }
                        else
                        {
                                $group_desc = htmlspecialchars_uni($group['description']);
                        }

                        $table->construct_cell("<strong><a href=\"index.php?module=config-settings&amp;action=change&amp;gid={$group['gid']}\">{$group_title}</a></strong> ({$group['settingcount']} {$lang->bbsetti>
                        $table->construct_row();
                }



RE: Mybb Php 8.0 - JimR - 2021-07-14

found another usercp.php around line 4382  is_array should change to isset
if(isset($subscriptions))
 another warning gone


RE: Mybb Php 8.0 - Devilshakerz - 2021-07-14

Added fixes to https://github.com/mybb/mybb/pull/4386

Also related: https://github.com/mybb/mybb/issues/4411


RE: Mybb Php 8.0 - Gene Steinberg - 2021-07-19

Even with the above changes, I still get, with PHP 8.0.8:

our copy of MyBB running on Attack of the Rockoids Community Forums (https://rockoids.com/forums) has experienced an error. Details of the error include:
---
Type: 2
File: index.php (Line no. 239)
Message
Undefined array key "hiddencount"
Back Trace: #0 errorHandler->email_error(2, Undefined array key "hiddencount", index.php, 239) called at [/home/rockoids/public_html/forums/inc/class_error.php:203]
#1 errorHandler->error(2, Undefined array key "hiddencount", index.php, 239) called at [/home/rockoids/public_html/forums/index.php:239]


RE: Mybb Php 8.0 - JimR - 2021-07-19

(2021-07-19, 05:26 AM)Gene Steinberg Wrote: Even with the above changes, I still get, with PHP 8.0.8:

our copy of MyBB running on Attack of the Rockoids Community Forums (https://rockoids.com/forums) has experienced an error. Details of the error include:
---
Type: 2
File: index.php (Line no. 239)
Message
Undefined array key "hiddencount"
Back Trace: #0  errorHandler->email_error(2, Undefined array key "hiddencount", index.php, 239) called at [/home/rockoids/public_html/forums/inc/class_error.php:203]
#1  errorHandler->error(2, Undefined array key "hiddencount", index.php, 239) called at [/home/rockoids/public_html/forums/index.php:239]

try this 
if(isset($bdaycache[$bdaydate]))
        {
                if (isset($bdaycache[$bdaydate]['hiddencount'])) {
                        $hiddencount = $bdaycache[$bdaydate]['hiddencount'];
                $today_bdays = $bdaycache[$bdaydate]['users'];
                }
        }