From: Pierre Joye Date: Thu, 4 Feb 2010 09:02:19 +0000 (+0000) Subject: - prevent possible crash when error/warnings are raised during startup on windows X-Git-Tag: php-5.3.2RC2~56 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5edfecaec1a57ca34428633e860062e444268f6;p=php - prevent possible crash when error/warnings are raised during startup on windows --- diff --git a/main/main.c b/main/main.c index a75bf08d6c..a7c9d818ec 100644 --- a/main/main.c +++ b/main/main.c @@ -980,6 +980,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ php_log_err(log_buffer TSRMLS_CC); efree(log_buffer); } + if (PG(display_errors) && ((module_initialized && !PG(during_request_startup)) || (PG(display_startup_errors) @@ -1008,7 +1009,12 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ if ((!strcmp(sapi_module.name, "cli") || !strcmp(sapi_module.name, "cgi")) && PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR ) { +#ifdef PHP_WIN32 + fprintf(stderr, "%s: %s in %s on line%d\n", error_type_str, buffer, error_filename, error_lineno); + fflush(stderr); +#else fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno); +#endif } else { php_printf("%s\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)); } @@ -1850,7 +1856,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod #endif EG(bailout) = NULL; EG(error_reporting) = E_ALL & ~E_NOTICE; - + EG(active_symbol_table) = NULL; PG(header_is_being_sent) = 0; SG(request_info).headers_only = 0; SG(request_info).argv0 = NULL;