From d940f2d38a12fab444cf5b5cb3dc7a14493f4db8 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 17 Jan 2012 09:30:12 +0000 Subject: [PATCH] Fixed workaround for bug #48034 on Windows (Crash when script is 8192 (8KB) bytes long) --- main/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/main.c b/main/main.c index 86b2cc1a15..7c4758a9bf 100644 --- a/main/main.c +++ b/main/main.c @@ -93,7 +93,7 @@ #include "SAPI.h" #include "rfc1867.h" -#if HAVE_MMAP +#if HAVE_MMAP || defined(PHP_WIN32) # if HAVE_UNISTD_H # include # if defined(_SC_PAGESIZE) @@ -1303,7 +1303,7 @@ PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *h php_stream *stream = php_stream_open_wrapper((char *)filename, "rb", mode, &handle->opened_path); if (stream) { -#if HAVE_MMAP +#if HAVE_MMAP || defined(PHP_WIN32) size_t page_size = REAL_PAGE_SIZE; #endif @@ -1317,7 +1317,7 @@ PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *h memset(&handle->handle.stream.mmap, 0, sizeof(handle->handle.stream.mmap)); len = php_zend_stream_fsizer(stream TSRMLS_CC); if (len != 0 -#if HAVE_MMAP +#if HAVE_MMAP || defined(PHP_WIN32) && ((len - 1) % page_size) <= page_size - ZEND_MMAP_AHEAD #endif && php_stream_mmap_possible(stream) -- 2.40.0