MyBB Community Forums

Full Version: "Undefined array key" errors after upgrading from php-7.4 to php-8.0
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2023-01-07, 05:59 PM)netllama Wrote: [ -> ]Thanks for the fast reply!  I'm seeing this error with your new version of functions_search.php:

Type: 2
File: inc/functions_search.php (Line no. 1241)
Message
Undefined array key 0
Back Trace: 
#0  errorHandler->email_error(2, Undefined array key 0, inc/functions_search.php, 1241) called at [/var/www/html/dv-test0/inc/class_error.php:229]
#1  errorHandler->error(2, Undefined array key 0, inc/functions_search.php, 1241) called at [/var/www/html/dv-test0/inc/class_error.php:153]
#2  errorHandler->error_callback(2, Undefined array key 0, /var/www/html/dv-test0/inc/functions_search.php, 1241) called at [/var/www/html/dv-test0/inc/functions_search.php:1241]
#3  perform_search_mysql(Array ([keywords] => death,[author] => ,[postthread] => 1,[matchusername] => 0,[postdate] => 0,[pddir] => 0,[forums] => Array ([0] => ),[findthreadst] => 0,[numreplies] => 0,[threadprefix] => Array ())) called at [/var/www/html/dv-test0/search.php:1603]

This could fix it:
[attachment=45700]
(2023-01-07, 08:58 PM)SvePu Wrote: [ -> ]
(2023-01-07, 05:59 PM)netllama Wrote: [ -> ]Thanks for the fast reply!  I'm seeing this error with your new version of functions_search.php:

Type: 2
File: inc/functions_search.php (Line no. 1241)
Message
Undefined array key 0
Back Trace: 
#0  errorHandler->email_error(2, Undefined array key 0, inc/functions_search.php, 1241) called at [/var/www/html/dv-test0/inc/class_error.php:229]
#1  errorHandler->error(2, Undefined array key 0, inc/functions_search.php, 1241) called at [/var/www/html/dv-test0/inc/class_error.php:153]
#2  errorHandler->error_callback(2, Undefined array key 0, /var/www/html/dv-test0/inc/functions_search.php, 1241) called at [/var/www/html/dv-test0/inc/functions_search.php:1241]
#3  perform_search_mysql(Array ([keywords] => death,[author] => ,[postthread] => 1,[matchusername] => 0,[postdate] => 0,[pddir] => 0,[forums] => Array ([0] => ),[findthreadst] => 0,[numreplies] => 0,[threadprefix] => Array ())) called at [/var/www/html/dv-test0/search.php:1603]

This could fix it:

Yes, that does resolve all the search issues that I reported, thanks!

(2023-01-07, 05:57 PM)SvePu Wrote: [ -> ]A lot of issues will be fixed here => https://github.com/mybb/mybb/pull/4613/f...71e7df0dcd

Does this include the youtube related problems that I reported too?
I want to report another issue with upgrading from PHP 7.2 to 8.0.27.

While registering on the forum NoCAPTCHA reCAPTCHA is throwing 2 errors, see attachment

I switched to reCAPTCHA v3 without any errors.
bump...

still seeing these problems which are blocking an upgrade to a supported php version.
(2023-03-31, 11:29 PM)netllama Wrote: [ -> ]still seeing these problems which are blocking an upgrade to a supported php version.

Many of what used to be Notices in PHP 7 are now Warnings in PHP 8.
Some Warnings in 7 are now Errors in 8.
Errors in 7 are still Errors in 8.
Generally speaking.

Errors stop execution, Warnings generally continue with no deleterious effects.
There are no reported Errors which stop MyBB running on my forum, either core or my simple list of plugins.

There are several options for resolution.
1. Log all warnings, locate code and fix with core edits. This is beyond the scope of most MyBB forum admins.
2. Wait for code fixes in 1.8.34, meanwhile log errors only.
3. Stay on unsupported PHP 7.

You may be able to control error reporting with MultiPHP Manager to disable warnings and notices but continue reporting errors. Your php.ini can include
error_reporting = E_ALL & ~E_WARNING & ~E_NOTICE
See this thread for more details. https://community.mybb.com/thread-237799.html
The OP's problem was settings overridden by a plugin, but information in the thread may be helpful for you.

Regardless, I do not recommend sending emails when warnings occur. You will be flooded with them with PHP 8.
The reason to email them is because some occur during form submission so would not be easily visible because the page redirects away, or they may be generated by others users, so emailing them allows you to see errors you may otherwise have missed. Once you’ve gathered all the errors that are happening, you’d be able to disable emailing them.

Edit: just realised logging them to the error log will cover that Toungue
Not all, but at least 2 domains block emails from my server domain, and still not resolved. Email flood prompting block started when I switched to PHP8.
(2023-04-01, 11:42 AM)HLFadmin Wrote: [ -> ]
(2023-03-31, 11:29 PM)netllama Wrote: [ -> ]still seeing these problems which are blocking an upgrade to a supported php version.

Many of what used to be Notices in PHP 7 are now Warnings in PHP 8.
Some Warnings in 7 are now Errors in 8.
Errors in 7 are still Errors in 8.
Generally speaking.

Errors stop execution, Warnings generally continue with no deleterious effects.
There are no reported Errors which stop MyBB running on my forum, either core or my simple list of plugins.

There are several options for resolution.
1. Log all warnings, locate code and fix with core edits. This is beyond the scope of most MyBB forum admins.
2. Wait for code fixes in 1.8.34, meanwhile log errors only.
3. Stay on unsupported PHP 7.

You may be able to control error reporting with MultiPHP Manager to disable warnings and notices but continue reporting errors. Your php.ini can include
error_reporting = E_ALL & ~E_WARNING & ~E_NOTICE
See this thread for more details. https://community.mybb.com/thread-237799.html
The OP's problem was settings overridden by a plugin, but information in the thread may be helpful for you.

Regardless, I do not recommend sending emails when warnings occur. You will be flooded with them with PHP 8.

Are you saying that all the youtube related spew that I reported earlier are not errors? An undefined array key seems like an error to me.
Oh, I thought you were following along with the bug reports.
See this thread and others.
https://community.mybb.com/thread-237617.html

(2023-01-08, 05:52 PM)netllama Wrote: [ -> ]
(2023-01-07, 05:57 PM)SvePu Wrote: [ -> ]A lot of issues will be fixed here => https://github.com/mybb/mybb/pull/4613/f...71e7df0dcd

Does this include the youtube related problems that I reported too?

Yes. yuliu's code changes are more elegant than mine. You can make core changes in class_parser.php now, or wait for next update.
Seems like this should be fixed in 1.8.34 that was released today?
Pages: 1 2