cvs: php4 / main.c php.h

[email protected] ("Zeev Suraski") Fri, 02 Jun 2000 12:35:53 -0000
Newsgroups php.version4
Message-ID <cvszeev959949353@cvsserver>
zeev		Fri Jun  2 05:35:53 2000 EDT

  Modified files:
    /php4	main.c php.h 
  Log:
  Use the new error code
  @- Added set_error_handler() to allow custom error handling functions,
  @  instead of the built-in error handling code (Zeev, Zend Engine)
  @- Renamed user_error() to trigger_error();  user_error() remains
  @  defined for compatibility (Zeev, Zend Engine)
  
  
Index: php4/main.c
diff -u php4/main.c:1.258 php4/main.c:1.259
--- php4/main.c:1.258	Wed May 31 07:02:36 2000
+++ php4/main.c	Fri Jun  2 05:35:53 2000
@@ -19,7 +19,7 @@
 */
 
 
-/* $Id: main.c,v 1.258 2000/05/31 14:02:36 thies Exp $ */
+/* $Id: main.c,v 1.259 2000/06/02 12:35:53 zeev Exp $ */
 
 
 #include <stdio.h>
@@ -319,16 +319,8 @@
 
 
 /* extended error handling function */
-#if ZEND_NEW_ERROR_HANDLING
 static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list orig_args)
-#else
-PHPAPI void php_error_cb(int type, const char *format, ...)
-#endif
 {
-#if !ZEND_NEW_ERROR_HANDLING
-	char *error_filename = NULL;
-	uint error_lineno;
-#endif
 	char buffer[1024];
 	int size = 0;
 	va_list args;
@@ -336,43 +328,6 @@
 	ELS_FETCH();
 	PLS_FETCH();
 
-#if !ZEND_NEW_ERROR_HANDLING
-	switch (type) {
-		case E_CORE_ERROR:
-		case E_CORE_WARNING:
-			error_filename = NULL;
-			error_lineno = 0;
-			break;
-		case E_PARSE:
-		case E_COMPILE_ERROR:
-		case E_COMPILE_WARNING:
-		case E_ERROR:
-		case E_NOTICE:
-		case E_WARNING:
-		case E_USER_ERROR:
-		case E_USER_WARNING:
-		case E_USER_NOTICE:
-			if (zend_is_compiling()) {
-				error_filename = zend_get_compiled_filename(CLS_C);
-				error_lineno = zend_get_compiled_lineno(CLS_C);
-			} else if (zend_is_executing()) {
-				error_filename = zend_get_executed_filename(ELS_C);
-				error_lineno = zend_get_executed_lineno(ELS_C);
-			} else {
-				error_filename = NULL;
-				error_lineno = 0;
-			}
-			break;
-		default:
-			error_filename = NULL;
-			error_lineno = 0;
-			break;
-	}
-
-	if (!error_filename) {
-		error_filename = "Unknown";
-	}
-#endif
 		
 	if (EG(error_reporting) & type || (type & E_CORE)) {
 		char *error_type_str;
@@ -406,11 +361,7 @@
 
 		/* get include file name */
 		if (PG(log_errors) || PG(display_errors) || (!module_initialized)) {
-#if ZEND_NEW_ERROR_HANDLING
 			args = orig_args;
-#else
-			va_start(args, format);
-#endif
 			size = vsnprintf(buffer, sizeof(buffer) - 1, format, args);
 			va_end(args);
 			buffer[sizeof(buffer) - 1] = 0;
@@ -452,11 +403,7 @@
 	if (PG(track_errors)) {
 		pval *tmp;
 
-#if ZEND_NEW_ERROR_HANDLING
 		args = orig_args;
-#else
-		va_start(args, format);
-#endif
 		size = vsnprintf(buffer, sizeof(buffer) - 1, format, args);
 		va_end(args);
 
Index: php4/php.h
diff -u php4/php.h:1.100 php4/php.h:1.101
--- php4/php.h:1.100	Mon May 29 10:08:01 2000
+++ php4/php.h	Fri Jun  2 05:35:53 2000
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php.h,v 1.100 2000/05/29 17:08:01 hholzgra Exp $ */
+/* $Id: php.h,v 1.101 2000/06/02 12:35:53 zeev Exp $ */
 
 #ifndef _PHP_H
 #define _PHP_H
@@ -248,12 +248,7 @@
 extern int Debug(char *format, ...);
 extern int cfgparse(void);
 
-#if ZEND_NEW_ERROR_HANDLING
 #define php_error zend_error
-#else
-extern PHPAPI void php_error_cb(int type, const char *format, ...);
-#define php_error php_error_cb
-#endif
 
 
 #define zenderror phperror