bjori           Mon Apr 14 15:42:14 2008 UTC

  Modified files:              
    /php-src/ext/standard       basic_functions.c 
    /php-src/ext/standard/tests/general_functions       ini_get_all.phpt 
  Log:
  MFB5.3: Remove config_get_hash() & and add new boolean parameter to
  ini_get_all() to list ini entries key=>current_value like config_get_hash()
   did.
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.893&r2=1.894&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.893 
php-src/ext/standard/basic_functions.c:1.894
--- php-src/ext/standard/basic_functions.c:1.893        Mon Apr  7 10:39:43 2008
+++ php-src/ext/standard/basic_functions.c      Mon Apr 14 15:42:13 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.893 2008/04/07 10:39:43 colder Exp $ */
+/* $Id: basic_functions.c,v 1.894 2008/04/14 15:42:13 bjori Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -957,10 +957,6 @@
 ZEND_END_ARG_INFO()
 
 static
-ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0)
-ZEND_END_ARG_INFO()
-
-static
 ZEND_BEGIN_ARG_INFO_EX(arginfo_import_request_variables, 0, 0, 1)
        ZEND_ARG_INFO(0, types)
        ZEND_ARG_INFO(0, prefix)
@@ -3452,7 +3448,6 @@
        PHP_FE(connection_status,                                               
                                                arginfo_connection_status)
        PHP_FE(ignore_user_abort,                                               
                                                arginfo_ignore_user_abort)
        PHP_FE(parse_ini_file,                                                  
                                                arginfo_parse_ini_file)
-       PHP_FE(config_get_hash,                                                 
                                                arginfo_config_get_hash)
        PHP_FE(is_uploaded_file,                                                
                                                arginfo_is_uploaded_file)
        PHP_FE(move_uploaded_file,                                              
                                                arginfo_move_uploaded_file)
 
@@ -5652,6 +5647,7 @@
 {
        zval *ini_array = va_arg(args, zval *);
        int module_number = va_arg(args, int);
+       int details = va_arg(args, int);
        zval *option;
        TSRMLS_FETCH();
 
@@ -5663,40 +5659,49 @@
                hash_key->type != IS_STRING ||
                hash_key->arKey.s[0] != 0
        ) {
-               MAKE_STD_ZVAL(option);
-               array_init(option);
+               if (details) {
+                       MAKE_STD_ZVAL(option);
+                       array_init(option);
+
+                       if (ini_entry->orig_value) {
+                               add_ascii_assoc_utf8_stringl(option, 
"global_value", ini_entry->orig_value, ini_entry->orig_value_length, 1);
+                       } else if (ini_entry->value) {
+                               add_ascii_assoc_utf8_stringl(option, 
"global_value", ini_entry->value, ini_entry->value_length, 1);
+                       } else {
+                               add_ascii_assoc_null(option, "global_value");
+                       }
 
-               if (ini_entry->orig_value) {
-                       add_ascii_assoc_utf8_stringl(option, "global_value", 
ini_entry->orig_value, ini_entry->orig_value_length, 1);
-               } else if (ini_entry->value) {
-                       add_ascii_assoc_utf8_stringl(option, "global_value", 
ini_entry->value, ini_entry->value_length, 1);
-               } else {
-                       add_ascii_assoc_null(option, "global_value");
-               }
+                       if (ini_entry->value) {
+                               add_ascii_assoc_utf8_stringl(option, 
"local_value", ini_entry->value, ini_entry->value_length, 1);
+                       } else {
+                               add_ascii_assoc_null(option, "local_value");
+                       }
+
+                       add_ascii_assoc_long(option, "access", 
ini_entry->modifiable);
 
-               if (ini_entry->value) {
-                       add_ascii_assoc_utf8_stringl(option, "local_value", 
ini_entry->value, ini_entry->value_length, 1);
+                       add_ascii_assoc_zval_ex(ini_array, ini_entry->name, 
ini_entry->name_length, option);
                } else {
-                       add_ascii_assoc_null(option, "local_value");
+                       if (ini_entry->value) {
+                               add_ascii_assoc_utf8_stringl(ini_array, 
ini_entry->name, ini_entry->value, ini_entry->value_length, 1);
+                       } else {
+                               add_ascii_assoc_null(ini_array, 
ini_entry->name);
+                       }
                }
-
-               add_ascii_assoc_long(option, "access", ini_entry->modifiable);
-
-               add_ascii_assoc_zval_ex(ini_array, ini_entry->name, 
ini_entry->name_length, option);
        }
        return 0;
 }
 /* }}} */
 
-/* {{{ proto array ini_get_all([string extension]) U
+/* {{{ proto array ini_get_all([string extension[, bool details = true]]) U
    Get all configuration options */
 PHP_FUNCTION(ini_get_all)
 {
        char *extname = NULL;
        int extname_len = 0, extnumber = 0;
        zend_module_entry *module;
+       zend_bool details = 1;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s&", &extname, 
&extname_len, UG(ascii_conv)) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s&!b", &extname, 
&extname_len, UG(ascii_conv), &details) == FAILURE) {
                return;
        }
 
@@ -5711,7 +5716,7 @@
        }
 
        array_init(return_value);
-       zend_hash_apply_with_arguments(EG(ini_directives), (apply_func_args_t) 
php_ini_get_option, 2, return_value, extnumber TSRMLS_CC);
+       zend_hash_apply_with_arguments(EG(ini_directives), (apply_func_args_t) 
php_ini_get_option, 2, return_value, extnumber, details TSRMLS_CC);
 }
 /* }}} */
 
@@ -6416,17 +6421,6 @@
 }
 /* }}} */
 
-/* {{{ proto array config_get_hash(void)
- Return all configuration valus as an array */
-PHP_FUNCTION(config_get_hash)
-{
-       HashTable *hash = php_ini_get_configuration_hash();
-
-       array_init(return_value);
-       zend_hash_apply_with_arguments(hash, (apply_func_args_t) 
add_config_entry_cb, 1, return_value TSRMLS_CC);
-}
-/* }}} */
-
 static int copy_request_variable(void *pDest, int num_args, va_list args, 
zend_hash_key *hash_key) /* {{{ */
 {
        zval *prefix, new_key;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/ini_get_all.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/standard/tests/general_functions/ini_get_all.phpt
diff -u php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.3 
php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.4
--- php-src/ext/standard/tests/general_functions/ini_get_all.phpt:1.3   Sun May 
 6 13:11:11 2007
+++ php-src/ext/standard/tests/general_functions/ini_get_all.phpt       Mon Apr 
14 15:42:14 2008
@@ -1,5 +1,8 @@
 --TEST--
 ini_get_all() tests
+--INI--
+pcre.backtrack_limit=100000
+pcre.recursion_limit=100000
 --SKIPIF--
 <?php if (!extension_loaded("reflection")) die("skip"); ?>
 --FILE--
@@ -10,6 +13,8 @@
 var_dump(ini_get_all("nosuchextension"));
 var_dump(ini_get_all("reflection"));
 var_dump(ini_get_all("pcre"));
+var_dump(ini_get_all("pcre", false));
+var_dump(ini_get_all("reflection", false));
 
 var_dump(ini_get_all("", ""));
 
@@ -45,9 +50,17 @@
     int(7)
   }
 }
+array(2) {
+  ["pcre.backtrack_limit"]=>
+  string(6) "100000"
+  ["pcre.recursion_limit"]=>
+  string(6) "100000"
+}
+array(0) {
+}
 
-Warning: ini_get_all() expects at most 1 parameter, 2 given in %s on line %d
-NULL
+Warning: ini_get_all(): Unable to find extension '' in %sini_get_all.php on 
line %d
+bool(false)
 Done
 --UEXPECTF--
 unicode(5) "array"
@@ -79,7 +92,15 @@
     int(7)
   }
 }
+array(2) {
+  [u"pcre.backtrack_limit"]=>
+  unicode(6) "100000"
+  [u"pcre.recursion_limit"]=>
+  unicode(6) "100000"
+}
+array(0) {
+}
 
-Warning: ini_get_all() expects at most 1 parameter, 2 given in %s on line %d
-NULL
+Warning: ini_get_all(): Unable to find extension '' in %sini_get_all.php on 
line %d
+bool(false)
 Done



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to