Req #51855 [Opn->Csd]: Optional tuning parameter for get_defined_functions and get_defined_constants
| From: | requinix@php.net | Date: | Sun, 29 Jul 2018 02:27:01 +0000 |
| Subject: | Req #51855 [Opn->Csd]: Optional tuning parameter for get_defined_functions and get_defined_constants | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216514@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51855&edit=1
ID: 51855
Updated by: requinix@php.net
Reported by: a at b dot c dot de
Summary: Optional tuning parameter for get_defined_functions
and get_defined_constants
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Unknown/Other Function
Operating System: Irrelevant
PHP Version: 5.3.2
-Assigned To:
+Assigned To: requinix
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2018-07-29 02:23:20] a at b dot c dot de
As suggested in the original post, and due to the resolution of bug #47161, this can now be resolved
as
get_defined_functions()['internal']
------------------------------------------------------------------------
[2016-03-25 20:06:28] andreas at dqxtech dot net
https://bugs.php.net/bug.php?id=71903&thanks=4
------------------------------------------------------------------------
[2010-05-19 02:04:25] a at b dot c dot de
Oh, one other thing ... the optional parameter to get_defined_constants() would be of type mixed:
give it true and it behaves as it does currently, give it a string and it will restrict its results
to the extension with the given name.
------------------------------------------------------------------------
[2010-05-19 02:02:51] a at b dot c dot de
Description:
------------
get_defined_constants() offers an optional parameter which, when passed true, categorises the
constants by extension.
get_defined_functions() returns a list of function names categorised by whether they are
"user" or "internal".
Both could benefit from being able to specify an actual category, instead of just that the returned
list be categorised. For example, get_defined_functions('internal') would return a
one-dimensional numerically-indexed array of internally-defined functions.
It's mainly for convenience: avoiding the extra variable, and depending on the internals some
work collating the data.
Since the list of extensions is so variable from configuration to configuration, it would be
infeasible to define("DEFINED_CONSTANTS_PCRE", "pcre") and so forth.
If the syntax engine could be convinced then this suggestion would be redundant, since it could then
be achieved as get_defined_functions()['internal'].
Test script:
---------------
print_r(get_defined_functions('internal'));
Equivalent to:
$functions = get_defined_functions();
print_r($functions['internal']);
Expected result:
----------------
Array(
[0] => zend_version
[1] => func_num_args
[2] => func_get_arg
[3] => func_get_args
[4] => strlen
....
)
Actual result:
--------------
A Warning is triggered stating that get_defined_functions() expects exactly 0 parameters, not the 1
that it was given. print_r() outputs null.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=51855&edit=1