Hello everyone!
First of: did you know that following the link in activation email instantly asks you to change your password after activating?
(Guess a leftover of issues you had a while ago.)
To the matter at hand, I'm not sure IF this is a SP bug, an SMF bug or another type of bug; so didn't put it in the Bugs board. If you'd like it there (anyway), I suppose one can move.
I was working on debugging a very weird issue together with SleePy earlier today on a forum I have running, and we ran in to some weirdness caused by a Simple Portal block. It is fixed now, but we're not exactly sure how it's fixed. ("It works! I have no idea why!")
But just in case this is a bug: we figured it would be nice to inform you, so you could have a look and potentially fix it; if its indeed an SP bug.
The problem:
Forum displays a white page on index + boards + topics, but no error is generated. Status is 200 OK.
That's a fun way to start your debugging efforts! Not a single error generated anywhere, the white page is apparently "expected". :')
Nothing changed to the server configuration, nothing changed to the forum configuration, nothing changed to the code, no new mods or changes there: absolutely nothing changed. It just simply stopped working out of nowhere.
(Note: other SMF + SP installations on the exact same server had no issues whatsoever.)
Last but not least: the admin pages, including SP admin, still worked fine. Just the boardindex and all vital functions were throwing a white page.
There were some errors in the error_log, but we've had to dismiss them later on:
[05-Mar-2017 02:18:18 America/Los_Angeles] PHP Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in /home/username/public_html/smf/Sources/Subs.php on line 2865
which seems to refer to:
// Was the page title set last minute? Also update the HTML safe one.
if (!empty($context['page_title']) && empty($context['page_title_html_safe']))
$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
// Start up the session URL fixer.
ob_start('ob_sessrewrite');
This error has some results on the smf community, but nobody ever seems to have figured it out other than thinking the server config to be the likely culprit. (In this case: the server configuration has been eliminated as culprit for 99.9%.) But that error had not been generated anymore for hours, so when doing a differential diagnose: we had to test without keeping that error in mind as well. If an error doesn't generate for such a long time, all caches are gone and you're definitely making requests: it's unlikely to be the problem itself. (Maybe related, but that's another story.
)
We did some last changes to ob_start in various portions of the code (like the gzhandler) and tested some server configuration changes. No joy, so we can probably rule that error out as current culprit.
After we started disabling pieces of code one by one, it turned out that disabling this section in Subs.php got the forum to load again:
// Just so we don't get caught in an endless loop of errors from the footer...
if (!$footer_done)
{
$footer_done = true;
template_footer();
We commented out template_footer();.
Forum loads again, no problem! Ok... that's odd. So let's see why.
We altered the code to:
var_dump(array_reverse($context['template_layers']));
echo __LINE__; die;
foreach (array_reverse($context['template_layers']) as $layer)
loadSubTemplate($layer . '_below', true);
Which outputs:
array(3) { [0]=> string(6) "portal" [1]=> string(4) "body" [2]=> string(4) "html" } 3553
Ok cool, we now figured out the issue is highly likely in Simple Portal somewhere. Blocks? Let's start with them!
In Simple Portal, we disabled a block for Recent Topics. Instant hit. This was the Block causing the issue.
This fixes the issue, no more white page displaying. Everything works again, just Recent Topics are gone.
Enabling it again? Instant white page! Disable any other block? No differences. Only "Recent Topics" causes the problem.
But in comes the voodoo...
We want to keep the forum online, but still have Recent Topics enabled so we can debug pieces of code. So we start setting up Recent Topics permissions to Deny everyone except for admins. We figured that way, only Administrators will get the white page - and regular members can continue using the board. Best way to debug.
And the admins will just have to deal with it.(tm)
... But much to my surprise, the forum kept loading after re-enabling Recent Topics again after changing permissions. Even whilst logged in as Administrator. o0
This was rather baffling, so I reverted the permissions back to normal and wanted to start over.
Lo and behold: the forum still works!
No white pages displaying anymore, and Recent Topics is showing up to everyone just fine!
Now, we have absolutely no idea how this could happen. We don't know enough about SP's inner workings either. But the very act of changing the permissions, fixed the problem. Of course changing the permissions was probably just random, I bet if we just clicked "Edit block" without changing anything or something simple like a name: it would have worked again as well.
Apparently, editing the block overwrote something somewhere (in the database I imagine?) - and fixed the problem.
To add to the confusion, we pretty much ruled out any caching being the culprit.
- Cache folder empty, but cleared for good measure.
- Server-side cachers forcefully cleared entirely.
- Even killed memcached to ensure that couldn't be doing anything
So all caches cleared: the problem still persisted. Not until we did "Edit block" did everything suddenly get fixed and come back online.
When looking at SP's code, SleePy briefly thought the problem could actually be in SSI.php as opposed to within Simple Portal - but after studying it further, it turns out that could not be the culprit. And resetting permissions on that Block fixing the error pretty much eliminated it even further as potential culprit.
Now of course we're uber interested to hear if anybody knows exactly *how* this can happen, and why Editing the block fixed it.
We're a bit amazed at how/why this could've happened, and why "Edit block" instantly fixes it. (What could it have overwritten? And how does it become corrupt?)
We figured maybe it is a bug in Simple Portal somewhere, also since it would appear there've been more (but extremely few) cases in which this just happened without explanation; in which case it would of course be nice to inform you of this so it can perhaps be fixed.
Thanks, and if it is indeed a bug: hope this is sufficient information for you to find/fix the problem.
I included as much information as I can recall from memory to describe the issue and show the relevant pieces of code,
but if you need more information: I might have more - just ask and I'll see if I have it.