cvs: php4 / TODO main.c php_ini.c php_ini.h /ext/standard/ info.c

[email protected] ("Zeev Suraski") Sat, 03 Jun 2000 03:05:29 -0000
Newsgroups php.version4
Message-ID <cvszeev960001529@cvsserver>
zeev		Fri Jun  2 20:05:29 2000 EDT

  Modified files:
    /php4	TODO main.c php_ini.c php_ini.h 
    /php4/ext/standard	info.c 
  Log:
  - Make the INI entries sorted in phpinfo()
  
  
Index: php4/TODO
diff -u php4/TODO:1.85 php4/TODO:1.86
--- php4/TODO:1.85	Thu Jun  1 06:52:08 2000
+++ php4/TODO	Fri Jun  2 20:05:28 2000
@@ -9,7 +9,6 @@
 
 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 
Index: php4/main.c
diff -u php4/main.c:1.259 php4/main.c:1.260
--- php4/main.c:1.259	Fri Jun  2 05:35:53 2000
+++ php4/main.c	Fri Jun  2 20:05:28 2000
@@ -19,7 +19,7 @@
 */
 
 
-/* $Id: main.c,v 1.259 2000/06/02 12:35:53 zeev Exp $ */
+/* $Id: main.c,v 1.260 2000/06/03 03:05:28 zeev Exp $ */
 
 
 #include <stdio.h>
@@ -384,6 +384,24 @@
 					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
 		}
 	}
 
@@ -667,6 +685,10 @@
 	ELS_FETCH();
 	SLS_FETCH();
 	PLS_FETCH();
+
+	if (setjmp(EG(bailout))!=0) {
+		return;
+	}
 
 	sapi_send_headers();
 	php_end_ob_buffering(SG(request_info).headers_only?0:1);
Index: php4/php_ini.c
diff -u php4/php_ini.c:1.35 php4/php_ini.c:1.36
--- php4/php_ini.c:1.35	Thu May 18 08:34:21 2000
+++ php4/php_ini.c	Fri Jun  2 20:05:28 2000
@@ -82,6 +82,32 @@
 	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
  */
Index: php4/php_ini.h
diff -u php4/php_ini.h:1.22 php4/php_ini.h:1.23
--- php4/php_ini.h:1.22	Thu May 18 08:34:21 2000
+++ php4/php_ini.h	Fri Jun  2 20:05:28 2000
@@ -55,6 +55,8 @@
 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);
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.95 php4/ext/standard/info.c:1.96
--- php4/ext/standard/info.c:1.95	Fri May 26 17:24:03 2000
+++ php4/ext/standard/info.c	Fri Jun  2 20:05:29 2000
@@ -228,6 +228,7 @@
 		PUTS("</a>\n");
 	}
 
+	php_ini_sort_entries();
 
 	if (flag & PHP_INFO_CONFIGURATION) {
 		php_info_print_hr();