]> granicus.if.org Git - php/commitdiff
- MFH: Parameter parsing changes for get_defined_constants() (Kalle)
authorFelipe Pena <felipe@php.net>
Thu, 7 May 2009 12:08:09 +0000 (12:08 +0000)
committerFelipe Pena <felipe@php.net>
Thu, 7 May 2009 12:08:09 +0000 (12:08 +0000)
Zend/tests/017.phpt
Zend/zend_builtin_functions.c

index 09ad123c7e742df4c63c768c21e82b67c2e80dfd..03c1e73175a340e1cc711e4126d45a6e26d451ba 100644 (file)
@@ -60,7 +60,7 @@ 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
 string(5) "array"
 string(5) "array"
index 6f1774de273a802b1aef3521836c70c8c1364d79..4c430274c42a46dc5207b781a45163857e761498 100644 (file)
@@ -1805,19 +1805,19 @@ ZEND_FUNCTION(get_loaded_extensions)
 /* }}} */
 
 
-/* {{{ proto array get_defined_constants([mixed categorize])
+/* {{{ proto array get_defined_constants([bool categorize])
    Return an array containing the names and values of all defined constants */
 ZEND_FUNCTION(get_defined_constants)
 {
-       int argc = ZEND_NUM_ARGS();
-
-       if (argc != 0 && argc != 1) {
-               ZEND_WRONG_PARAM_COUNT();
+       zend_bool categorize = 0;
+       
+       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;