1
0
mirror of https://github.com/php/php-src.git synced 2026-04-03 22:22:18 +02:00

- MFH: Respect value of the parameter for get_loaded_extensions() and only

print zend extensions if set to true
This commit is contained in:
Johannes Schlüter
2007-08-02 16:54:44 +00:00
parent 959aa4f596
commit c0667eeaff
2 changed files with 13 additions and 18 deletions

View File

@@ -12,7 +12,9 @@ var_dump(get_resource_type($fp));
var_dump(gettype(get_loaded_extensions()));
var_dump(count(get_loaded_extensions()));
var_dump(gettype(get_loaded_extensions(true)));
var_dump(count(get_loaded_extensions(true)));
var_dump(get_loaded_extensions(true, true));
define("USER_CONSTANT", "test");
@@ -52,7 +54,11 @@ string(6) "stream"
string(7) "Unknown"
string(5) "array"
int(%d)
int(2)
string(5) "array"
int(0)
Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in /home/johannes/src/php/PHP_5_2/Zend/tests/017.php on line 14
NULL
Warning: Wrong parameter count for get_defined_constants() in %s on line %d
NULL

View File

@@ -1570,31 +1570,20 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
}
/* {{{ proto array get_loaded_extensions([mixed categorize]) U
/* {{{ proto array get_loaded_extensions([bool zend_extensions]) U
Return an array containing names of loaded extensions */
ZEND_FUNCTION(get_loaded_extensions)
{
int argc = ZEND_NUM_ARGS();
int zendext = 0;
if (argc != 0 && argc != 1) {
ZEND_WRONG_PARAM_COUNT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &zendext) == FAILURE) {
return;
}
array_init(return_value);
if (argc) {
zval *modules;
zval *extensions;
MAKE_STD_ZVAL(modules);
array_init(modules);
zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, modules TSRMLS_CC);
add_assoc_zval_ex(return_value, "PHP Modules", sizeof("PHP Modules"), modules);
MAKE_STD_ZVAL(extensions);
array_init(extensions);
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) add_zendext_info, extensions TSRMLS_CC);
add_assoc_zval_ex(return_value, "Zend Extensions", sizeof("Zend Extensions"), extensions);
if (zendext) {
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) add_zendext_info, return_value TSRMLS_CC);
} else {
zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC);
}