Why does SMF use eval()?

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

Previous topic - Next topic

[Unknown]

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]

joh87swe

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

Cordially,
Johan

Thantos

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?

goitalone

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?


metallica48423

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
Search
Settings Repair Tool

H

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
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

goitalone

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

CiHaD

mee to ?

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

goitalone

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 :)

Advertisement: