Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) / zend_builtin_functions.c /tests 017.phpt

From: Date: Wed, 01 Aug 2007 07:45:45 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) / zend_builtin_functions.c /tests 017.phpt
References: 1  Groups: php.doc php.zend-engine.cvs 
Request: Send a blank email to phpdoc+get-969377199@lists.php.net to get a copy of this message
Johannes, the patch looks a bit weird to me. You called new parameter "categorize", which to my understanding means that the only difference it makes - adds categories to the list of extensions. But that's not what it does, since without it the list is not the same. I suggest we should either add zend extensions to the list when new parameter is not passed (this way the parameter would really "categorize" the list) OR return _only_ zend extensions when it's passed (and rename the parameter). That would make much more sense to me. What do you think?
-/* {{{ proto array get_loaded_extensions(void) +/* {{{ proto array get_loaded_extensions([mixed categorize]) U
    Return an array containing names of loaded extensions */
ZEND_FUNCTION(get_loaded_extensions) { - if (ZEND_NUM_ARGS() != 0) { + int argc = ZEND_NUM_ARGS(); + + if (argc != 0 && argc != 1) { ZEND_WRONG_PARAM_COUNT(); } array_init(return_value); - zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC); + + 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); + } else { + zend_hash_apply_with_argument(&module_registry, (apply_func_arg_t) add_extension_info, return_value TSRMLS_CC); + } } /* }}} */
-- Wbr, Antony Dovgal

« previous php.doc (#969377199) next »