]> granicus.if.org Git - php/commitdiff
Use the new error code
authorZeev Suraski <zeev@php.net>
Fri, 2 Jun 2000 12:35:53 +0000 (12:35 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 2 Jun 2000 12:35:53 +0000 (12:35 +0000)
@- 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)

main/main.c
main/php.h

index 3b82c488bbf5b702c843c1d781ee332b95b63c61..2aee2042d0e38dc39094b5dd6ba85d438b02bb78 100644 (file)
@@ -319,16 +319,8 @@ PHPAPI int php_printf(const char *format, ...)
 
 
 /* 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 @@ PHPAPI void php_error_cb(int type, const char *format, ...)
        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 @@ PHPAPI void php_error_cb(int type, const char *format, ...)
 
                /* 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 @@ PHPAPI void php_error_cb(int type, const char *format, ...)
        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 2a3ba785440af5327bee05c861c3f161a4359120..20d0f1cbde41686ff3b3552d4520514ce616b2cd 100644 (file)
@@ -248,12 +248,7 @@ extern void php_log_err(char *log_message);
 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