Deprecate the parameter of get_defined_functions() (#19425)

RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_exclude_disabled_parameter_of_get_defined_functions
This commit is contained in:
Gina Peter Banyard 2025-08-09 11:22:43 +01:00 committed by GitHub
parent f64c6248b5
commit 94a15cc92f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 20 deletions

View file

@ -1,16 +0,0 @@
--TEST--
Bug #79668 (get_defined_functions(true) may miss functions)
--INI--
disable_functions=sha1_file,password_hash
--FILE--
<?php
$df = get_defined_functions(true);
foreach (['sha1', 'sha1_file', 'hash', 'password_hash'] as $funcname) {
var_dump(in_array($funcname, $df['internal'], true));
}
?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(false)

View file

@ -1483,15 +1483,15 @@ ZEND_FUNCTION(get_defined_functions)
zval internal, user;
zend_string *key;
zend_function *func;
bool exclude_disabled = 1;
bool exclude_disabled = true;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &exclude_disabled) == FAILURE) {
RETURN_THROWS();
}
if (exclude_disabled == 0) {
if (ZEND_NUM_ARGS() == 1) {
zend_error(E_DEPRECATED,
"get_defined_functions(): Setting $exclude_disabled to false has no effect");
"get_defined_functions(): The $exclude_disabled parameter has no effect since PHP 8.0");
}
array_init(&internal);

View file

@ -22,6 +22,8 @@ var_dump(in_array($disabled_function, $functions['internal']));
--EXPECTF--
bool(false)
Deprecated: get_defined_functions(): Setting $exclude_disabled to false has no effect in %s on line %d
Deprecated: get_defined_functions(): The $exclude_disabled parameter has no effect since PHP 8.0 in %s on line %d
bool(false)
Deprecated: get_defined_functions(): The $exclude_disabled parameter has no effect since PHP 8.0 in %s on line %d
bool(false)