summaryrefslogtreecommitdiff
path: root/main/php_ini.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-06-03 03:05:29 +0000
committerZeev Suraski <zeev@php.net>2000-06-03 03:05:29 +0000
commitd1f1d4052746191023cb0bbd8ab0e2f189f1a65f (patch)
treec3eed25b6096d8c64e03da3868d95c418312b063 /main/php_ini.c
parentd4b160c0d69e4b40b5023bf606d17107fd5dd7d5 (diff)
downloadphp-git-d1f1d4052746191023cb0bbd8ab0e2f189f1a65f.tar.gz
- Make the INI entries sorted in phpinfo()
Diffstat (limited to 'main/php_ini.c')
-rw-r--r--main/php_ini.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/main/php_ini.c b/main/php_ini.c
index b6be054bcc..44e7347bb3 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -82,6 +82,32 @@ int php_ini_rshutdown()
return SUCCESS;
}
+
+static int ini_key_compare(const void *a, const void *b)
+{
+ Bucket *f;
+ Bucket *s;
+
+ f = *((Bucket **) a);
+ s = *((Bucket **) b);
+
+ if (f->nKeyLength==0 && s->nKeyLength==0) { /* both numeric */
+ return ZEND_NORMALIZE_BOOL(f->nKeyLength - s->nKeyLength);
+ } else if (f->nKeyLength==0) { /* f is numeric, s is not */
+ return -1;
+ } else if (s->nKeyLength==0) { /* s is numeric, f is not */
+ return 1;
+ } else { /* both strings */
+ return zend_binary_strcasecmp(f->arKey, f->nKeyLength, s->arKey, s->nKeyLength);
+ }
+}
+
+
+void php_ini_sort_entries()
+{
+ zend_hash_sort(&known_directives, qsort, ini_key_compare, 0);
+}
+
/*
* Registration / unregistration
*/