天一博胜企业管理软件V1.0 源代码
25
type, const char *format, ...) { char *params; va_list args; spprintf(¶ms, 0, \ va_start(args, format); php_verror(docref, params ? params : \ va_end(args); if (params) { efree(params); } }
/* }}} */
/* {{{ php_html_puts */
PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC) { zend_html_puts(str, size TSRMLS_CC); }
/* }}} */
/* {{{ php_suppress_errors */
PHPAPI void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC) { PG(error_handling) = error_handling; PG(exception_class) = exception_class; if (PG(last_error_message)) { free(PG(last_error_message)); PG(last_error_message) = NULL; } if (PG(last_error_file)) { free(PG(last_error_file)); PG(last_error_file) = NULL; } PG(last_error_lineno) = 0; }
/* }}} */
/* {{{ php_error_cb
extended error handling function */
static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) { char *buffer; int buffer_len, display; TSRMLS_FETCH(); buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args); /* check for repeated errors to be ignored */ if (PG(ignore_repeated_errors) && PG(last_error_message)) { /* no check for PG(last_error_file) is needed since it cannot * be NULL if PG(last_error_message) is not NULL */ if (strcmp(PG(last_error_message), buffer) || (!PG(ignore_repeated_source) && ((PG(last_error_lineno) != (int)error_lineno)
天一博胜企业管理软件V1.0 源代码
26
|| strcmp(PG(last_error_file), error_filename)))) { display = 1; } else { display = 0; } } else { display = 1; }
/* store the error if it has changed */ if (display) { if (PG(last_error_message)) { free(PG(last_error_message)); } if (PG(last_error_file)) { free(PG(last_error_file)); } PG(last_error_type) = type; PG(last_error_message) = strdup(buffer); PG(last_error_file) = strdup(error_filename); PG(last_error_lineno) = error_lineno; }
/* according to error handling mode, suppress error, throw exception or show it */ if (PG(error_handling) != EH_NORMAL) { switch (type) { case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: case E_PARSE: /* fatal errors are real errors and cannot be made exceptions */ break; case E_STRICT: /* for the sake of BC to old damaged code */ break; case E_NOTICE: case E_USER_NOTICE: /* notices are no errors and are not treated as such like E_WARNINGS */ break; default: /* throw an exception if we are in EH_THROW mode * but DO NOT overwrite a pending exception */ if (PG(error_handling) == EH_THROW && !EG(exception)) { zend_throw_error_exception(PG(exception_class), buffer, 0, type TSRMLS_CC); } efree(buffer); return; } }
/* display/log the error if necessary */
if (display && (EG(error_reporting) & type || (type & E_CORE)) && (PG(log_errors) || PG(display_errors) || (!module_initialized))) {
天一博胜企业管理软件V1.0 源代码
27
char *error_type_str; switch (type) { case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: error_type_str = \ break; case E_RECOVERABLE_ERROR: error_type_str = \ break; case E_WARNING: case E_CORE_WARNING: case E_COMPILE_WARNING: case E_USER_WARNING: error_type_str = \ break; case E_PARSE: error_type_str = \ break; case E_NOTICE: case E_USER_NOTICE: error_type_str = \ break; case E_STRICT: error_type_str = \ break; default: error_type_str = \ break; } if (!module_initialized || PG(log_errors)) { char *log_buffer; #ifdef PHP_WIN32 if ((type == E_CORE_ERROR || type == E_CORE_WARNING) && PG(display_startup_errors)) { MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE); } #endif spprintf(&log_buffer, 0, \ %s in %s on line %d\error_lineno); php_log_err(log_buffer TSRMLS_CC); efree(log_buffer); } if (PG(display_errors) && ((module_initialized && !PG(during_request_startup)) || (PG(display_startup_errors) && (OG(php_body_write)==php_default_output_func || OG(php_body_write)==php_ub_body_write_no_header || OG(php_body_write)==php_ub_body_write) ) ) ) {
天一博胜企业管理软件V1.0 源代码
28
if (PG(xmlrpc_errors)) { php_printf(\
version=\\\%ld
\\n%s\STR_PRINT(prepend_string), error_type_str, buf, error_filename, error_lineno, STR_PRINT(append_string)); efree(buf); } else { php_printf(\/>\\n%s: %s in %s on line %d
\\n%s\STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); } } else { /* Write CLI/CGI errors to stderr if display_errors = \ if ((!strcmp(sapi_module.name, \ PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR ) { fprintf(stderr, \error_lineno); } else { php_printf(\%s in %s on line %d\\n%s\STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); } } } }
#if ZEND_DEBUG if (PG(report_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 - %s\error_filename, error_lineno,
相关推荐: