php function_exists("eval") fails
If i call function_exists("eval") on my server, it returns false. But the function eval() exists and works fine.
This is mostly a curiosity question: Please don't lecture me on how i shouldn't use eval() because it's potentially dangerous. If my hosting service were to disable eval(), i could work around that, but would like to know how to tell if this function is avalable. I can call get_defined_functions() and get a list about a mile long which does indeed include eval() along with other potentially 'dangerous' php functions. If i call ini_get('disable_functions'), i get an empty list. Other functions, for example function_exists("exec") returns true. Why does function_exists("eval") return false? |
It might treat built-in language constructs and user-defined functions differently. (The documentation mentions 'include' as an example: it also looks like a function, but function_exists gives FALSE for it.)
> would like to know how to tell if this function is available. I would try this: Code:
$evalok= FALSE; |
NevemTeve appears to be on the right track - eval is not a function. From the PHP manual:
Code:
Note: Because this is a language construct and not a function, it cannot be called using variable functions. |
Quote:
The question was "Why does function_exists("eval") return false?" and the answer is "eval is a language construct and not a function". An interesting follow-up question might be why eval (and others, e.g. isset) are implemented as language constructs instead of functions. |
Quote:
Quote:
Code:
function myException($exception) { |
One more remark:
Quote:
|
Final note: from this web page, I found the following:
Quote:
- which means my original concern was over nothing. It would appear that eval() can never be disabled, so i have no need to wonder. I will now mark this thread as 'Solved' |
All times are GMT -5. The time now is 09:29 AM. |