views:

490

answers:

3

Hello All,

Is there a way to disable eval function without doing so from php.ini file. I have tried ini_set function but even that doesn't work.

Basically I want my framework users to decide whether this function should be enabled or not through a config file. If they say no, i should be able to disable it using code as i can't go to server of each users where my framework is installed and disabling it using php.ini file.

As i said without goint to php.ini file, so ini directive disable_functions should not be posted in answers.

Please help.

+1  A: 

if this is *mod_php* (not CGI) with apache, .htaccess will work. other than that... bad luck.

just somebody
+1  A: 

I guess you could call override_function with a new function which does nothing. (req APD)

Tim
It's not a function, it's a language construct.
Björn
+5  A: 

It won't work, because eval() is not a function - it's a language construct. You can disable it with suhosin, a protection system for PHP. That's the only way I know of.

From PHP.net:

Note: Because this is a language construct and not a function,
it cannot be called using variable functions
Björn