News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Help with errors

Started by skb, September 20, 2017, 04:25:49 AM

Previous topic - Next topic

skb

I need some help in understanding this. Please guide me;

While going through my error_log, I come across several errors, one example is reproduced here :

[16-Sep-2017 03:56:57 America/Los_Angeles] PHP Parse error:  syntax error, unexpected 'if' (T_IF), expecting ',' or ';' in /home/diabesv6/public_html/forum/Sources/Load.php(2277) : eval()'d code on line 61

When I look through Load.php, Line 61 is irrelevant. It is part of the (green) explanatory notes on top of the file. When I look at line 2277, this is the code I find
$file_found = file_exists($filename) && eval('?' . '>' . rtrim(file_get_contents($filename))) !== false;
there is no "if"

If I look around line 2277 the code is as below;

// Are we going to use eval?
if (empty($modSettings['disableTemplateEval']))
{
$file_found = file_exists($filename) && eval('?' . '>' . rtrim(file_get_contents($filename))) !== false;
$settings['current_include_filename'] = $filename;
}
else
{
$file_found = file_exists($filename);

if ($once && $file_found)
require_once($filename);
elseif ($file_found)
require($filename);
}

if ($file_found !== true)
{
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput']))
@ob_start('ob_gzhandler');
else
ob_start();

if (isset($_GET['debug']) && !WIRELESS)
header('Content-Type: application/xhtml+xml; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));


Which 'if' is to be replaced with "," or ";"

Thanks for taking time out to help me understand.

SMF 2.1.4 / TP 2.2.2

Shambles

Quoteeval()'d code on line 61

Template evaluation is disguising the origin of your problem.

Turn off evaluation (Admin > Configuration >Server Settings > General > Disable evaluation of templates)

.. then report back.

skb

Done.

So I suppose the eval errors will not generate now. In which case, why is this even an option?

BTW, I like what you've done to your forum name. For a moment I thought you were an Arab.   ;D

SMF 2.1.4 / TP 2.2.2

Shambles

QuoteSo I suppose the eval errors will not generate now

The true origin of the error should manifest itself in subsequent error message(s), leading you to the exact file & line number.

As for my username, well my own UK forum is mostly visited by Australians so I find it easier to read their posts when I'm facing the same way ;)

Arantor

Ok, so the reason for the eval is so that if your template has a fatal error, SMF can catch it and provide something of a nicer page.

In this case it's line 61 of whichever template file is broken but since you provided no other information, e.g. which URL it is, I can't help you.

Turning eval off means you still get the error but users may get a broken layout or a white page rather than a screen which warns them about the problem.

Advertisement: