# retrieving information about state of a function

- Thread: https://externals.io/message/4634
- Original archive: https://news-web.php.net/php.internals/4634
- Started by Dennis Sterzenbach on 2003-10-01T09:26:26+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #4634 — Dennis Sterzenbach — 2003-10-01T09:26:26+00:00

URL: https://externals.io/message/4634#4634

Hi,

I recognized there isn't any built-in function which
tells the disabled/enabled state of some function.
I think of something like:

if (function_enabled("shell_exec")) {
   $info = shell_exec("dig myname.com");
}

telling if shell_exec is disabled by php.ini setting
or not.

I already implemented a check which uses an `ini_get()` to
retrieve the list of disabled functions, but I think it
would be more smooth having a function provided by PHP
for that purpose, because there are functions for all the
other kinds of checks: included files, declared classes,
defined constants/variables, defined functions, etc.

Why not having a function which gives information about
disabled/enabled state of a function?

I think if the function was provided by PHP makes it
faster. -Think of having to `explode()` and `in_array()` check
for the function. The PHP engine could simply have the
list of disabled functions to hand a true/false directly
from C code. Which seems to be the more consequent and
ideal solution.


--
 Dennis Sterzenbach
 www.darknoise.de

---

## #4635 — Derick Rethans — 2003-10-01T09:30:33+00:00

URL: https://externals.io/message/4634#4635 · In reply to: #4634

> Hi,
> 
> I recognized there isn't any built-in function which
> tells the disabled/enabled state of some function.
> I think of something like:
> 
> if (function_enabled("shell_exec")) {
>    $info = shell_exec("dig myname.com");
> }
> 
> telling if shell_exec is disabled by php.ini setting
> or not.

You can either use `function_exists()` to check if a function is 
available, or use "ini_get('disabled_functions')".

Derick

-- 
"Interpreting what the GPL actually means is a job best left to those
                    that read the future by examining animal entrails."
-------------------------------------------------------------------------
 Derick Rethans                                 http://derickrethans.nl/ 
 International PHP Magazine                          http://php-mag.net/
