News:

Wondering if this will always be free?  See why free is better.

Main Menu

Re: What';s causing this subs.php error please?

Started by smartmouse, May 06, 2020, 09:09:54 AM

Previous topic - Next topic

smartmouse

Hello, I have the same error in the forum logs:

"Invalid argument supplied for foreach()" on Sources/Subs.php (Line 3832).

3832: foreach (array_reverse($context['template_layers']) as $layer)
3833: loadSubTemplate($layer . '_below', true);
3834: }


My htaccess file is not empty. It is generated by PrettyUrls mod.

Currently I have 20,000 errors about that line in the logs panel.
How can I fix it?

SpacePhoenix

That means that the foreach was expecting to be given an array to work with but wasn't (probably either an interger or a string was received instead).

Whatever bit of code that is meant to build the $context['template_layers'] array, fails to do so. A quick fix for it would be to locate the code that is supposed to generate the $context['template_layers'] array and have it firstly create the $context['template_layers'] array as an empty array, that way the foreach will always be given an array to work with

Arantor

Well, $context['template_layers'] in a normal setup is made automatically by SMF... that sounds like a mod is breaking it.

Is it every page or is it specific to certain pages?
Holder of controversial views, all of which my own.


Aaron10

Yeah same issue here, it is indeed caused by prettyurls (every page)

Advertisement: