Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_builtin_functions.c /tests 017.phpt
| From: | Marcus Boerger | Date: | Thu, 02 Aug 2007 18:51:54 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_builtin_functions.c /tests 017.phpt | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-5943@lists.php.net to get a copy of this message | ||
Hello Johannes,
Thursday, August 2, 2007, 6:52:59 PM, you wrote:
> johannes Thu Aug 2 16:52:59 2007 UTC
> Modified files:
> /ZendEngine2 zend_builtin_functions.c
> /ZendEngine2/tests 017.phpt
> Log:
> - Respect value of the parameter for get_loaded_extensions() and
> get_defined_cosntants()
>
>
>
> http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.344&r2=1.345&diff_format=u
> Index: ZendEngine2/zend_builtin_functions.c
> diff -u ZendEngine2/zend_builtin_functions.c:1.344
> ZendEngine2/zend_builtin_functions.c:1.345
> --- ZendEngine2/zend_builtin_functions.c:1.344 Tue Jul 31 22:45:07 2007
> +++ ZendEngine2/zend_builtin_functions.c Thu Aug 2 16:52:59 2007
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_builtin_functions.c,v 1.344 2007/07/31 22:45:07 johannes Exp $ */
> +/* $Id: zend_builtin_functions.c,v 1.345 2007/08/02 16:52:59 johannes Exp $ */
>
> #include "zend.h"
> #include "zend_API.h"
> @@ -1667,50 +1667,39 @@
> }
> /* }}} */
>
> -/* {{{ 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;
This should actually be a zend_bool
>
> - 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_ascii_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_ascii_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);
> }
> }
> /* }}} */
>
> -/* {{{ proto array get_defined_constants([mixed categorize]) U
> +/* {{{ proto array get_defined_constants([bool categorize]) U
> Return an array containing the names and values of all defined constants */
> ZEND_FUNCTION(get_defined_constants)
> {
> - int argc = ZEND_NUM_ARGS();
> + int categorize = 0;
>
> - if (argc != 0 && argc != 1) {
> - ZEND_WRONG_PARAM_COUNT();
> + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &categorize)
> == FAILURE) {
> + return;
> }
>
> array_init(return_value);
>
> - if (argc) {
> + if (categorize) {
> HashPosition pos;
> zend_constant *val;
> int module_number;
>
> http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/017.phpt?r1=1.2&r2=1.3&diff_format=u
> Index: ZendEngine2/tests/017.phpt
> diff -u ZendEngine2/tests/017.phpt:1.2 ZendEngine2/tests/017.phpt:1.3
> --- ZendEngine2/tests/017.phpt:1.2 Tue Jul 31 22:45:08 2007
> +++ ZendEngine2/tests/017.phpt Thu Aug 2 16:52:59 2007
> @@ -12,7 +12,9 @@
>
> 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,9 +54,13 @@
> string(7) "Unknown"
> string(5) "array"
> int(%d)
> -int(2)
> +string(5) "array"
> +int(%d)
> +
> +Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s line %d
> +NULL
>
> -Warning: Wrong parameter count for get_defined_constants() in %s on line %d
> +Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line %d
> NULL
> string(5) "array"
> string(5) "array"
> @@ -88,9 +94,13 @@
> unicode(7) "Unknown"
> unicode(5) "array"
> int(%d)
> -int(2)
> +unicode(5) "array"
> +int(%d)
> +
> +Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s on line %d
> +NULL
>
> -Warning: Wrong parameter count for get_defined_constants() in %s on line %d
> +Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line %d
> NULL
> unicode(5) "array"
> unicode(5) "array"
Best regards,
Marcus