mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Reverse patches that slipped in by mistake in a whitespace patch. They
require some more work...
This commit is contained in:
parent
9bcacd36f5
commit
1e125df0d1
@ -36,7 +36,6 @@
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_variables.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/head.h"
|
||||
|
||||
#ifdef WITH_ZEUS
|
||||
# include "httpext.h"
|
||||
@ -62,7 +61,7 @@ exception trapping when running under a debugger
|
||||
#define ISAPI_POST_DATA_BUF 1024
|
||||
|
||||
static zend_bool bFilterLoaded=0;
|
||||
static zend_bool bIgnoreCrashes=0;
|
||||
static zend_bool bTerminateThreadsOnError=0;
|
||||
|
||||
static char *isapi_special_server_variable_names[] = {
|
||||
"ALL_HTTP",
|
||||
@ -298,7 +297,7 @@ static int php_isapi_startup(sapi_module_struct *sapi_module)
|
||||
|| zend_startup_module(&php_isapi_module)==FAILURE) {
|
||||
return FAILURE;
|
||||
} else {
|
||||
bIgnoreCrashes = (zend_bool) INI_INT("isapi.ignore_crashes");
|
||||
bTerminateThreadsOnError = (zend_bool) INI_INT("isapi.terminate_threads_on_error");
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -692,28 +691,23 @@ BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
|
||||
}
|
||||
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
static int php_isapi_exception_handler(LPEXCEPTION_POINTERS ep TSRMLS_DC)
|
||||
static void my_endthread()
|
||||
{
|
||||
if (ep->ExceptionRecord->ExceptionCode==EXCEPTION_STACK_OVERFLOW) {
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
#ifdef PHP_WIN32
|
||||
if (bTerminateThreadsOnError) {
|
||||
_endthread();
|
||||
}
|
||||
if (ep->ExceptionRecord->ExceptionCode==EXCEPTION_ACCESS_VIOLATION) {
|
||||
char buf[1024];
|
||||
#endif
|
||||
}
|
||||
|
||||
_snprintf(buf, sizeof(buf)-1,"PHP has encountered an Access Violation at %p", ep->ExceptionRecord->ExceptionAddress);
|
||||
php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC);
|
||||
} else {
|
||||
char buf[1024];
|
||||
|
||||
_snprintf(buf, sizeof(buf)-1,"PHP has encountered an Unhandled Exception Code %d at %p", ep->ExceptionRecord->ExceptionCode , ep->ExceptionRecord->ExceptionAddress);
|
||||
php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC);
|
||||
}
|
||||
if (bIgnoreCrashes) {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
} else {
|
||||
exit(-1);
|
||||
}
|
||||
#ifdef PHP_WIN32
|
||||
/* ep is accessible only in the context of the __except expression,
|
||||
* so we have to call this function to obtain it.
|
||||
*/
|
||||
BOOL exceptionhandler(LPEXCEPTION_POINTERS *e, LPEXCEPTION_POINTERS ep)
|
||||
{
|
||||
*e=ep;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -721,6 +715,9 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
|
||||
{
|
||||
zend_file_handle file_handle;
|
||||
zend_bool stack_overflown=0;
|
||||
#ifdef PHP_ENABLE_SEH
|
||||
LPEXCEPTION_POINTERS e;
|
||||
#endif
|
||||
TSRMLS_FETCH();
|
||||
|
||||
zend_first_try {
|
||||
@ -760,9 +757,9 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
|
||||
efree(SG(request_info).cookie_data);
|
||||
}
|
||||
#ifdef PHP_ENABLE_SEH
|
||||
} __except(php_isapi_exception_handler(GetExceptionInformation() TSRMLS_CC)) {
|
||||
/* we only trap stack overflow exceptions */
|
||||
if (_exception_code() == EXCEPTION_STACK_OVERFLOW) {
|
||||
} __except(exceptionhandler(&e, GetExceptionInformation())) {
|
||||
char buf[1024];
|
||||
if (_exception_code()==EXCEPTION_STACK_OVERFLOW) {
|
||||
LPBYTE lpPage;
|
||||
static SYSTEM_INFO si;
|
||||
static MEMORY_BASIC_INFORMATION mi;
|
||||
@ -790,18 +787,24 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
|
||||
}
|
||||
|
||||
CG(unclean_shutdown)=1;
|
||||
php_header();
|
||||
sapi_isapi_ub_write("Stack overflow", sizeof("Stack overflow")-1 TSRMLS_CC);
|
||||
_snprintf(buf, sizeof(buf)-1,"PHP has encountered a Stack overflow");
|
||||
php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC);
|
||||
} else if (_exception_code()==EXCEPTION_ACCESS_VIOLATION) {
|
||||
_snprintf(buf, sizeof(buf)-1,"PHP has encountered an Access Violation at %p", e->ExceptionRecord->ExceptionAddress);
|
||||
php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC);
|
||||
my_endthread();
|
||||
} else {
|
||||
_snprintf(buf, sizeof(buf)-1,"PHP has encountered an Unhandled Exception Code %d at %p", e->ExceptionRecord->ExceptionCode , e->ExceptionRecord->ExceptionAddress);
|
||||
php_isapi_report_exception(buf, strlen(buf) TSRMLS_CC);
|
||||
my_endthread();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef PHP_ENABLE_SEH
|
||||
__try {
|
||||
php_request_shutdown(NULL);
|
||||
} __except(php_isapi_exception_handler(GetExceptionInformation() TSRMLS_CC)) {
|
||||
/* We should only get to this block in case of a stack overflow,
|
||||
* which is very unlikely
|
||||
*/
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) {
|
||||
my_endthread();
|
||||
}
|
||||
#else
|
||||
php_request_shutdown(NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user