Why does SMF use eval()?

Started by [Unknown], September 20, 2005, 04:59:35 PM

Previous topic - Next topic


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.



Can't find how to enable disableTemplateEval, I've searched in the database whithout any result.



Run the query that [Unknown] posted in your database interface.

Joshua Dickerson

* groundup wonders if there should be an interface for this
Come work with me at Promenade Group

Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?


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?


you should be able to do it after selecting your database in the left pane, then clicking sql
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"

Useful Links:
Online Manual!
How to Help us Help you
Settings Repair Tool


Quote from: groundup on April 18, 2007, 12:42:31 PM
* groundup 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
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)


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!!


mee to ?

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


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:


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