com php-src: Fix bug #31875 - get_defined_functions() should not list disabled functions.: Zend/zend _builtin_functions.c tests/basic/bug31875.p hpt

From: Date: Sat, 30 May 2015 15:29:27 +0000
Subject: com php-src: Fix bug #31875 - get_defined_functions() should not list disabled functions.: Zend/zend _builtin_functions.c tests/basic/bug31875.p hpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96540@lists.php.net to get a copy of this message
Commit: 978832331acdcb59114bdba28498c248c5188883 Author: Willian Gustavo Veiga <contact@willianveiga.com> Sat, 30 May 2015 12:29:27 -0300 Parents: 9237a0de1cc40c4cc53c31a0396bf26249e1d5a9 Branches: PHP-7.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=978832331acdcb59114bdba28498c248c5188883 Log: Fix bug #31875 - get_defined_functions() should not list disabled functions. Bugs: https://bugs.php.net/31875 Changed paths: M Zend/zend_builtin_functions.c A tests/basic/bug31875.phpt Diff: diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 6b65bdd..dff8f52 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1870,7 +1870,15 @@ static int copy_function_name(zval *zv, int num_args, va_list args, zend_hash_ke } if (func->type == ZEND_INTERNAL_FUNCTION) { - add_next_index_str(internal_ar, zend_string_copy(hash_key->key)); + char *disable_functions = INI_STR("disable_functions"); + + if (disable_functions != NULL) { + if (strstr(disable_functions, func->common.function_name->val) == NULL) { + add_next_index_str(internal_ar, zend_string_copy(hash_key->key)); + } + } else { + add_next_index_str(internal_ar, zend_string_copy(hash_key->key)); + } } else if (func->type == ZEND_USER_FUNCTION) { add_next_index_str(user_ar, zend_string_copy(hash_key->key)); } diff --git a/tests/basic/bug31875.phpt b/tests/basic/bug31875.phpt new file mode 100644 index 0000000..d29b7f1 --- /dev/null +++ b/tests/basic/bug31875.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #31875 get_defined_functions() should not list disabled functions +--CREDITS-- +Willian Gustavo Veiga <contact@willianveiga.com> +--INI-- +disable_functions=dl +--FILE-- +<?php +var_dump(in_array('dl', get_defined_functions())); +?> +--EXPECTF-- +bool(false)

« previous php.cvs (#96540) next »