diff options
author | Zeev Suraski <zeev@php.net> | 2000-06-03 03:05:29 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2000-06-03 03:05:29 +0000 |
commit | d1f1d4052746191023cb0bbd8ab0e2f189f1a65f (patch) | |
tree | c3eed25b6096d8c64e03da3868d95c418312b063 | |
parent | d4b160c0d69e4b40b5023bf606d17107fd5dd7d5 (diff) | |
download | php-git-d1f1d4052746191023cb0bbd8ab0e2f189f1a65f.tar.gz |
- Make the INI entries sorted in phpinfo()
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | ext/standard/info.c | 1 | ||||
-rw-r--r-- | main/main.c | 22 | ||||
-rw-r--r-- | main/php_ini.c | 26 | ||||
-rw-r--r-- | main/php_ini.h | 2 |
5 files changed, 51 insertions, 1 deletions
@@ -9,7 +9,6 @@ Zend global ------ - * sort ini entries so that phpinfo() show them in some nice order. * make everything on the language-level independent of your locale setings. * allow methods to be called as callbacks. eg: array_walk($myarray,"this->print()"); * always build the standalone executable as well as the chosen SAPI diff --git a/ext/standard/info.c b/ext/standard/info.c index 58637bbcb4..4b44feff2a 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -228,6 +228,7 @@ PHPAPI void php_print_info(int flag) PUTS("</a>\n"); } + php_ini_sort_entries(); if (flag & PHP_INFO_CONFIGURATION) { php_info_print_hr(); diff --git a/main/main.c b/main/main.c index 2aee2042d0..c02a34c843 100644 --- a/main/main.c +++ b/main/main.c @@ -384,6 +384,24 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ PUTS(append_string); } } +#if ZEND_DEBUG + { + zend_bool trigger_break; + + switch (type) { + case E_ERROR: + case E_CORE_ERROR: + case E_COMPILE_ERROR: + case E_USER_ERROR: + trigger_break=1; + break; + default: + trigger_break=0; + break; + } + zend_output_debug_string(trigger_break, "%s(%d) : %s - %s", error_filename, error_lineno, error_type_str, buffer); + } +#endif } } @@ -668,6 +686,10 @@ void php_request_shutdown(void *dummy) SLS_FETCH(); PLS_FETCH(); + if (setjmp(EG(bailout))!=0) { + return; + } + sapi_send_headers(); php_end_ob_buffering(SG(request_info).headers_only?0:1); 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 */ diff --git a/main/php_ini.h b/main/php_ini.h index 09669624bf..47965baaa5 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -55,6 +55,8 @@ int php_ini_mstartup(void); int php_ini_mshutdown(void); int php_ini_rshutdown(void); +void php_ini_sort_entries(); + PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number); PHPAPI void php_unregister_ini_entries(int module_number); PHPAPI void php_ini_refresh_caches(int stage); |