MyBB Community Forums

Full Version: "Undefined array key" error with php-8.1 coming from inc/datahandlers/post.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm attempting to upgrade to php-8.1 in an myBB-1.8.30 test environment, and its mostly working. However, every time I try to create a new thread + post, it seemingly works, but I also see the following error spew:
Type: 2
File: inc/datahandlers/post.php (Line no. 1715)
Message
Undefined array key 41
Back Trace: #0 /var/www/html/dv-test0/inc/class_error.php(229): errorHandler->email_error(2, 'Undefined array...', 'inc/datahandler...', 1715)
#1 /var/www/html/dv-test0/inc/class_error.php(153): errorHandler->error(2, 'Undefined array...', 'inc/datahandler...', 1715)
#2 /var/www/html/dv-test0/inc/datahandlers/post.php(1715): errorHandler->error_callback(2, 'Undefined array...', '/var/www/html/d...', 1715)
#3 /var/www/html/dv-test0/newthread.php(438): PostDataHandler->insert_thread()
I definitely don't see this behavior with php-7.4.x.
(2022-09-10, 11:04 PM)netllama Wrote: [ -> ]I'm attempting to upgrade to php-8.1 in an myBB-1.8.30 test environment, and its mostly working. However, every time I try to create a new thread + post, it seemingly works, but I also see the following error spew:
Type: 2
File: inc/datahandlers/post.php (Line no. 1715)
Message
Undefined array key 41
Back Trace: #0 /var/www/html/dv-test0/inc/class_error.php(229): errorHandler->email_error(2, 'Undefined array...', 'inc/datahandler...', 1715)
#1 /var/www/html/dv-test0/inc/class_error.php(153): errorHandler->error(2, 'Undefined array...', 'inc/datahandler...', 1715)
#2 /var/www/html/dv-test0/inc/datahandlers/post.php(1715): errorHandler->error_callback(2, 'Undefined array...', '/var/www/html/d...', 1715)
#3 /var/www/html/dv-test0/newthread.php(438): PostDataHandler->insert_thread()
I definitely don't see this behavior with php-7.4.x.

I'm having the same problem with PHP 8.0.188.0.18 8.0.188.0.18 8.0.188.0.188.0.18
As per MyBB's requirements your PHP version must be greater than or equal to 5.2 and less than 8.0.

Downgrade your PHP version.
php less than 8.0 is going EOL in less than 60 days. Most responsible admins need to plan & schedule upgrades. Its difficult to do that when there is no upgrade path with less than 60 days left.
This should be fixed in the next maintenance release (https://github.com/mybb/mybb/commit/0192...53d1cc2e58).

We'll likely remove the < 8.0 requirement soon, as most errors related to recent PHP versions should now be resolved.

Note that Warnings can be hidden from normal output, and simply logged (or ignored completely, depending on error handling settings).
Was this fix included in 1.8.32 ?