Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable eval function without going to php.ini file?

Tags:

function

php

eval

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.

like image 629
Sarfraz Avatar asked Dec 18 '25 22:12

Sarfraz


1 Answers

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 
like image 151
Björn Avatar answered Dec 20 '25 16:12

Björn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!