summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorRemi Collet <remi@php.net>2013-12-10 16:09:41 +0100
committerRemi Collet <remi@php.net>2013-12-10 16:09:41 +0100
commit9f4d1ee51c19c50a60284a5687f247785fd26f6a (patch)
treeea80b67a7be5e05bd4086f5afd67a3bcc2483f59 /Zend/zend_builtin_functions.c
parent552e8b2b4c5708cb90faf148bd99e3f67fa926b5 (diff)
parent3e963f8eb44863ef3d758eabe791190b0fd7bb9a (diff)
downloadphp-git-9f4d1ee51c19c50a60284a5687f247785fd26f6a.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fixed Bug #66218 zend_register_functions breaks reflection
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 1ad64e74ea..b2eb941fd8 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -2437,36 +2437,49 @@ ZEND_FUNCTION(extension_loaded)
Returns an array with the names of functions belonging to the named extension */
ZEND_FUNCTION(get_extension_funcs)
{
- char *extension_name;
- int extension_name_len;
+ char *extension_name, *lcname;
+ int extension_name_len, array;
zend_module_entry *module;
- const zend_function_entry *func;
-
+ HashPosition iterator;
+ zend_function *zif;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) {
return;
}
-
if (strncasecmp(extension_name, "zend", sizeof("zend"))) {
- char *lcname = zend_str_tolower_dup(extension_name, extension_name_len);
- if (zend_hash_find(&module_registry, lcname,
- extension_name_len+1, (void**)&module) == FAILURE) {
- efree(lcname);
- RETURN_FALSE;
- }
+ lcname = zend_str_tolower_dup(extension_name, extension_name_len);
+ } else {
+ lcname = estrdup("core");
+ }
+ if (zend_hash_find(&module_registry, lcname,
+ extension_name_len+1, (void**)&module) == FAILURE) {
efree(lcname);
+ RETURN_FALSE;
+ }
- if (!(func = module->functions)) {
- RETURN_FALSE;
- }
+ zend_hash_internal_pointer_reset_ex(CG(function_table), &iterator);
+ if (module->functions) {
+ /* avoid BC break, if functions list is empty, will return an empty array */
+ array_init(return_value);
+ array = 1;
} else {
- func = builtin_functions;
+ array = 0;
+ }
+ while (zend_hash_get_current_data_ex(CG(function_table), (void **) &zif, &iterator) == SUCCESS) {
+ if (zif->common.type==ZEND_INTERNAL_FUNCTION
+ && zif->internal_function.module == module) {
+ if (!array) {
+ array_init(return_value);
+ array = 1;
+ }
+ add_next_index_string(return_value, zif->common.function_name, 1);
+ }
+ zend_hash_move_forward_ex(CG(function_table), &iterator);
}
- array_init(return_value);
+ efree(lcname);
- while (func->fname) {
- add_next_index_string(return_value, func->fname, 1);
- func++;
+ if (!array) {
+ RETURN_FALSE;
}
}
/* }}} */