mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
More error handling work (still completely disabled)
This commit is contained in:
parent
095f1d91b1
commit
39aa59bdec
4 changed files with 37 additions and 5 deletions
|
@ -208,7 +208,7 @@ PHPAPI void php_print_info(int flag)
|
|||
}
|
||||
PUTS("?=PHPE9568F35-D428-11d2-A769-00AA001ACF42\" border=\"0\" align=\"right\"></a>\n");
|
||||
}
|
||||
php_printf("This program makes use of the Zend scripting language engine:<BR>%s<BR>\n", get_zend_version());
|
||||
php_printf("This program makes use of the Zend scripting language engine:<pre>%s</pre>\n", get_zend_version());
|
||||
php_info_print_box_end();
|
||||
}
|
||||
|
||||
|
|
23
main/main.c
23
main/main.c
|
@ -298,17 +298,24 @@ PHPAPI int php_printf(const char *format, ...)
|
|||
|
||||
|
||||
/* extended error handling function */
|
||||
PHPAPI void php_error(int type, const char *format, ...)
|
||||
#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
|
||||
{
|
||||
va_list args;
|
||||
#if !ZEND_NEW_ERROR_HANDLING
|
||||
char *error_filename = NULL;
|
||||
uint error_lineno;
|
||||
#endif
|
||||
char buffer[1024];
|
||||
int size = 0;
|
||||
va_list args;
|
||||
CLS_FETCH();
|
||||
ELS_FETCH();
|
||||
PLS_FETCH();
|
||||
|
||||
#if !ZEND_NEW_ERROR_HANDLING
|
||||
switch (type) {
|
||||
case E_CORE_ERROR:
|
||||
case E_CORE_WARNING:
|
||||
|
@ -344,6 +351,7 @@ PHPAPI void php_error(int type, const char *format, ...)
|
|||
if (!error_filename) {
|
||||
error_filename = "Unknown";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (EG(error_reporting) & type || (type & E_CORE)) {
|
||||
char *error_type_str;
|
||||
|
@ -377,7 +385,11 @@ PHPAPI void php_error(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;
|
||||
|
@ -419,9 +431,14 @@ PHPAPI void php_error(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);
|
||||
|
||||
buffer[sizeof(buffer) - 1] = 0;
|
||||
|
||||
ALLOC_ZVAL(tmp);
|
||||
|
@ -812,7 +829,7 @@ int php_module_startup(sapi_module_struct *sf)
|
|||
|
||||
php_output_startup();
|
||||
|
||||
zuf.error_function = php_error;
|
||||
zuf.error_function = php_error_cb;
|
||||
zuf.printf_function = php_printf;
|
||||
zuf.write_function = php_body_write_wrapper;
|
||||
zuf.fopen_function = php_fopen_wrapper_for_zend;
|
||||
|
|
|
@ -242,13 +242,20 @@ extern char **environ;
|
|||
#endif
|
||||
|
||||
extern void phperror(char *error);
|
||||
extern PHPAPI void php_error(int type, const char *format, ...);
|
||||
extern PHPAPI int php_write(void *buf, int size);
|
||||
extern PHPAPI int php_printf(const char *format, ...);
|
||||
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
|
||||
|
||||
|
||||
extern void html_putc(char c);
|
||||
|
||||
#define zenderror phperror
|
||||
|
|
|
@ -191,6 +191,10 @@ SOURCE=.\php_variables.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_virtual_cwd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ext\standard\quot_print.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -291,6 +295,10 @@ SOURCE=.\php_variables.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\php_virtual_cwd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ext\standard\quot_print.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue