MyBB Community Forums

Full Version: URGENT showthread.php, forumdisplay.php and possibly others with syntax errors.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Oh I don't know, $forum_stats is read from the cache after all. The question is why was it a string instead of an array... sounds like a bad value was obtained from the cache, and this is not caught by the code.

Hard to debug if this occurs only very rarely with no reliable way to reproduce.
Please replace:
		if($forum_stats[-1]['modtools'] || $forum_stats[$fid]['modtools'])

With:
		if($mybb->user['uid'] == YOUR_UID)
		{
			die("".print_r($forum_stats));
		}

		if($forum_stats[-1]['modtools'] || $forum_stats[$fid]['modtools'])

Replace YOUR_UID with your user ID.
Then visit that page again and post the output here.
alright, as soon as it happens again i'll change it to my uid and get the output for you.
i noticed 1.6.6 changed something forum stat related, but i'll keep an eye out for it to occur again.
Fatal error: Cannot use string offset as an array in /forum/forumdisplay.php on line 1196


alright i re-edited that file and the output is 1 :\
Weird, $forum_status is not even an array then
yeah, once i rebuild the cache it turns back to Array ( ) 1

it can affect single boards while not affecting others or all boards.

that its only affecting xcache though.... maybe the xcache developers and mybb devs need to work together to figure this out?
Ah, it turns empty arrays into empty strings, when the cache goes missing.

In inc/class_datacache.php

if($data == null)
{
    $data = '';
}

array() == null is true in PHP, so it sets it to empty string and subsequently stores it as empty string. Quite odd considering all MyBB default caches are arrays, not strings, and unserialize would return false, not null...

Just remove that code entirely (and rebuild all your caches). It makes no sense whatsoever. And if a cache just isn't there (not even in the DB) it's probably cleaner to set it to false/null/whatever than empty string/empty array anyway.
so will this also be resolved in a future update?

this was apparently mentioned in XCache docs regarding how it stores data

Quote:[18:55] <DrNach> Squall-Leonhart: I'm not sure what the overall intention is, if the intention is to stick it in XCache cleanly, XCache is unable to store certain types
[18:56] <DrNach> and it may be hard to tell if XCache is returning a type or data is not there, I forget if it returns null or false on no matching key
[18:56] <DrNach> If this is the problem they're trying to overcome, the correction solution is to call serialize() on the data before storing
[18:57] <DrNach> and unseralize it when retrieving (if it did not fail)
Pages: 1 2 3 4 5