MyBB Community Forums

Full Version: Syntax error in MyBB 1.8.17
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello
I have just installed MyBB Version 1.8.17 (Database created on Godaddy host: MySQL version 5.0 ) and I am in the process of testing it.
I get this syntax error whenever I try to post a thread:
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home/content/59/8920259/html/forummyBB/inc/datahandlers/post.php on line 264
Is this a known error?
Here is the code, starting on line 260 of post.php
// If database is mysql or mysqli check field type and set max database limit
                                                if(stripos($db->type, 'my') !== false)
                                                {
                                                                $fields = $db->show_fields_from("posts");
                                                                $dblimit = reset(array_filter(array_map(function($field)
                                                                {
                                                                                if($field['Field'] == 'message')
                                                                                {
                                                                                                switch(strtolower($field['Type']))
                                                                                                {
                                                                                                                case 'longtext':
                                                                                                                                return 4294967295;
                                                                                                                                break;
                                                                                                                case 'mediumtext':
                                                                                                                                return 16777215;
                                                                                                                                break;
                                                                                                                case 'text':
                                                                                                                default:
                                                                                                                                return 65535;
                                                                                                                                break;
                                                                                                }
                                                                                }
                                                                }, $fields)));
                                                }
 
Thank you for your help.
Hi,

This is a bug relating to the old version of PHP that you are using. It seems a recent release sneaked in an issue that makes the software incompatible with older versions, so I'm pushing this to GitHub.

To resolve this in the short term, you could try upgrading your PHP version to 5.3 or newer. It's worth noting that PHP 5.2 (which your host is likely running) is no longer supported by the PHP project and is massively out of date. Only PHP 7.1 and PHP 7.2 are currently actively supported by the PHP project: http://php.net/supported-versions.php - not supported versions may be vulnerable to attack, so if your host doesn't offer any newer supported versions, you need to ask them why not.
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/3368

Thanks for contributing to MyBB!

Regards,
The MyBB Group
(2018-07-29, 09:05 AM)Euan T Wrote: [ -> ]Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/3368

Thanks for contributing to MyBB!

Regards,
The MyBB Group

Thank you for your quick response. I will try it again with a newer version of PHP and let you know if the problem persists.
I get the same syntax error after I upgraded from 1.6.10 to 1.8.17.

PHP 5.2.17

MySQLi 5.1.73
(2018-08-27, 01:07 AM)JimTM Wrote: [ -> ]I get the same syntax error after I upgraded from 1.6.10 to 1.8.17.

PHP 5.2.17

MySQLi 5.1.73

That's quite the leap. I'd recommend using the latest version of MyBB.
This should be fixed in 1.8.18. I would also recommend upgrading your PHP version - PHP 5.2 hasn't been supported by the PHP team since 6 Jan 2011 - 7 years ago! Running an old version of PHP is highly recommended against as old versions have known security issues that could be exploited. You should upgrade to PHP 7.0 at the minimum. If your host doesn't offer modern PHP version, you should contact them and ask why.

MyBB 1.8 is supposed to be compatible with PHP 5.2, but MyBB 1.9 will not be when it is released.

Fore more information, please see the following links:

End Of Life (unsupported) PHP versions: http://php.net/eol.php
Supported PHP versions: http://php.net/supported-versions.php