From: Christoph M. Becker Date: Thu, 4 Jun 2020 06:47:25 +0000 (+0200) Subject: Merge branch 'PHP-7.3' into PHP-7.4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e38a1b352648f574754eab2c4ffc0421e75c9fe;p=php Merge branch 'PHP-7.3' into PHP-7.4 * PHP-7.3: Fix #79668: get_defined_functions(true) may miss functions --- 5e38a1b352648f574754eab2c4ffc0421e75c9fe diff --cc NEWS index f301e3ac89,1b8ff49509..172c1d7333 --- a/NEWS +++ b/NEWS @@@ -1,10 -1,11 +1,12 @@@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? ????, PHP 7.3.20 +?? ??? 2020, PHP 7.4.8 - Core: + . Fixed bug #79595 (zend_init_fpu() alters FPU precision). (cmb, Nikita) . Fixed bug #79650 (php-win.exe 100% cpu lockup). (cmb) + . Fixed bug #79668 (get_defined_functions(true) may miss functions). (cmb, + Nikita) - PDO SQLite: . Fixed bug #79664 (PDOStatement::getColumnMeta fails on empty result set). diff --cc Zend/zend_builtin_functions.c index 5658ec1158,bc3649a622..aeb837be92 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@@ -1807,10 -1863,7 +1807,9 @@@ ZEND_FUNCTION(get_declared_interfaces ZEND_FUNCTION(get_defined_functions) { zval internal, user; + zend_string *key; + zend_function *func; zend_bool exclude_disabled = 0; - char *disable_functions = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &exclude_disabled) == FAILURE) { return; @@@ -1820,24 -1873,7 +1819,16 @@@ array_init(&user); array_init(return_value); - if (exclude_disabled) { - disable_functions = INI_STR("disable_functions"); - } - zend_hash_apply_with_arguments(EG(function_table), copy_function_name, 3, &internal, &user, &exclude_disabled); + ZEND_HASH_FOREACH_STR_KEY_PTR(EG(function_table), key, func) { + if (key && ZSTR_VAL(key)[0] != 0) { - if (func->type == ZEND_INTERNAL_FUNCTION) { - if (disable_functions != NULL) { - if (strstr(disable_functions, func->common.function_name->val) == NULL) { - add_next_index_str(&internal, zend_string_copy(key)); - } - } else { - add_next_index_str(&internal, zend_string_copy(key)); - } ++ if (func->type == ZEND_INTERNAL_FUNCTION ++ && (!exclude_disabled || func->internal_function.handler != ZEND_FN(display_disabled_function))) { ++ add_next_index_str(&internal, zend_string_copy(key)); + } else if (func->type == ZEND_USER_FUNCTION) { + add_next_index_str(&user, zend_string_copy(key)); + } + } + } ZEND_HASH_FOREACH_END(); zend_hash_str_add_new(Z_ARRVAL_P(return_value), "internal", sizeof("internal")-1, &internal); zend_hash_str_add_new(Z_ARRVAL_P(return_value), "user", sizeof("user")-1, &user);