From 06388f5181b6b5389a1aaab1fedb90b0b267e064 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Fri, 2 Jun 2000 12:35:53 +0000 Subject: [PATCH] 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) --- main/main.c | 53 ----------------------------------------------------- main/php.h | 5 ----- 2 files changed, 58 deletions(-) diff --git a/main/main.c b/main/main.c index 3b82c488bb..2aee2042d0 100644 --- a/main/main.c +++ b/main/main.c @@ -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); diff --git a/main/php.h b/main/php.h index 2a3ba78544..20d0f1cbde 100644 --- a/main/php.h +++ b/main/php.h @@ -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 -- 2.40.0