From d1f1d4052746191023cb0bbd8ab0e2f189f1a65f Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Sat, 3 Jun 2000 03:05:29 +0000 Subject: - Make the INI entries sorted in phpinfo() --- main/php_ini.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'main/php_ini.c') 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 */ -- cgit v1.2.1