Simple Machines Community Forum

SMF Support => Server Performance and Configuration => Topic started by: [Unknown] on September 20, 2005, 04:59:35 PM

Title: Why does SMF use eval()?
Post by: [Unknown] on September 20, 2005, 04:59:35 PM
When loading template and language files, SMF uses eval() instead of require_once()/include_once().  The specific reason for this is that, with eval(), if there is an error, PHP tells SMF.  With include_once(), it just spits out an error.

Benchmarks show that eval() isn't much slower, and it's no more a security risk because we mean to include_once() the file anyway.  However, if you have an accelerator installed, like eAccelerator, eval() is slower.  Much slower.  And it uses more memory, too.

As such, you'll want to run the following query to disable eval():

REPLACE INTO smf_settings
   (variable, value)
VALUES ('disableTemplateEval', '1');

Please note that this will also disable the "pretty" error messages that highlight the line the error occured on, too.  All you get is PHP's error message, after this.  Still, it's not a huge price to pay... since you can always change it back to 0 when you mess with your templates.

-[Unknown]
Title: Re: Why does SMF use eval()?
Post by: joh87swe on April 17, 2007, 12:53:32 PM
Can't find how to enable disableTemplateEval, I've searched in the database whithout any result.

Cordially,
Johan
Title: Re: Why does SMF use eval()?
Post by: Thantos on April 17, 2007, 01:10:03 PM
Run the query that [Unknown] posted in your database interface.
Title: Re: Why does SMF use eval()?
Post by: Joshua Dickerson on April 18, 2007, 12:42:31 PM
/me wonders if there should be an interface for this
Title: Re: Why does SMF use eval()?
Post by: goitalone on May 15, 2007, 10:14:38 PM
I am not sure where to do this. After I submit the query, it says:

You have to choose at least one column to display.

Which column?

Title: Re: Why does SMF use eval()?
Post by: metallica48423 on May 16, 2007, 02:23:56 AM
you should be able to do it after selecting your database in the left pane, then clicking sql
Title: Re: Why does SMF use eval()?
Post by: H on May 16, 2007, 04:34:35 PM
Quote from: groundup on April 18, 2007, 12:42:31 PM
/me wonders if there should be an interface for this

If it isn't already it would make sense to have it auto-enabled when caching is enabled
Title: Re: Why does SMF use eval()?
Post by: goitalone on September 03, 2007, 12:03:31 PM
Ok, hey...way back when I never could figure out how to do this query thing..and I need to because I have like 10 billion errors in the forum error log..I need to figure how to resolve these I think.

Um...I am using MySql Administrator, can I use that to do this Query?

I am running my own home webserver and a buchna crap happened way back and it messed up my PHPMyAdmin and now I can't figure out how to fix it....it doesn't work anymore and I am pissed about the fact I spent 2 days trying to fix it and can't.

I basically don't know how to run a query period...Ima query noob!!
Title: Re: Why does SMF use eval()?
Post by: CiHaD on September 04, 2007, 10:34:03 AM
mee to ?

I am using MySql Administrator, can I use that to do this Query?
Title: Re: Why does SMF use eval()?
Post by: goitalone on September 04, 2007, 10:39:33 AM
I dunno still how to do it correctly from MySQL Admin cause it didn't work for me when I tried it, but my question has been resolved doing it a different way here:

http://www.simplemachines.org/community/index.php?topic=192818.msg1227674#msg1227674

Worked and I have fixed all my errors as well :)