Advertisement:

Author Topic: Help with errors  (Read 211 times)

Offline skb

  • Charter Member
  • Jr. Member
  • *
  • Posts: 201
    • Metabolically Challenged
Help with errors
« on: September 20, 2017, 04:25:49 AM »
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
Code: [Select]
$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;

Code: [Select]
// 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.
Learning, every day.
Forum - The Diabetic Pub
Because every diabetic needs help
SMF 2.0.14 (default theme) / TP 1.2R3

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,478
  • Gender: Male
    • i30 Owners Club
Re: Help with errors
« Reply #1 on: September 20, 2017, 04:55:35 AM »
Quote
eval()'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.

Offline skb

  • Charter Member
  • Jr. Member
  • *
  • Posts: 201
    • Metabolically Challenged
Re: Help with errors
« Reply #2 on: September 20, 2017, 05:21:40 AM »
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
Learning, every day.
Forum - The Diabetic Pub
Because every diabetic needs help
SMF 2.0.14 (default theme) / TP 1.2R3

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,478
  • Gender: Male
    • i30 Owners Club
Re: Help with errors
« Reply #3 on: September 20, 2017, 07:00:50 AM »
Quote
So 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 ;)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 67,878
    • Arantor on GitHub
Re: Help with errors
« Reply #4 on: September 20, 2017, 07:21:13 AM »
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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.