MyBB Community Forums

Full Version: in_array index.php error after Upgrade to 1.8.17
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
After upgradeing to to 1.8.17 i have now got this error on my main page

The following warnings occurred:
Warning [2] in_array() expects parameter 2 to be array, null given - Line: 363 - File: index.php PHP 7.0.30 (Linux)
File     Line     Function
[PHP]           errorHandler->error
/index.php     363     in_array

this is line 363

$expaltext = (in_array("boardstats", $collapse)) ? "[+]" : "[-]";

I have just tried to turn off the warning and error messages in the control panel and when I try and load the index page I receive this message

Content Encoding Error

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

Please contact the web site owners to inform them of this problem.
Did you upgrade from 1.8.17? If so, you need to use the full upgrade package, not the changed files package. This error is caused by having an old version of global.php.
(2018-07-16, 08:51 PM)darkloki99 Wrote: [ -> ]this is line 363

$expaltext = (in_array("boardstats", $collapse)) ? "[+]" : "[-]";

Please don't tell me, MyBB is allowing ternary operators now.  Undecided
There are several places (too many) in MyBB where ternary operator is used. Since like 6 years or so ....
For example:

[Image: 18_-1.png]

and looking at the error its not for ternary operator. The $collapse variable is NULL in your index.php which is kinda impossible (if you are using global.php of latest package) as $collapse is defined as array globally.

In global.php, line 1136:
$collapse = $collapsed = $collapsedimg = array();
I have just uploaded the new global.php from the full package 1.8.17 and it has fixed the error