summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/memory_streams.c4
-rw-r--r--main/php_open_temporary_file.c2
-rwxr-xr-xmain/streams.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/main/memory_streams.c b/main/memory_streams.c
index 5fadd14b86..1f77aa4fc9 100644
--- a/main/memory_streams.c
+++ b/main/memory_streams.c
@@ -221,7 +221,7 @@ PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC)
self->smax = -1;
self->mode = mode;
- stream = php_stream_alloc(&php_stream_memory_ops, self, 0, "rwb");
+ stream = php_stream_alloc(&php_stream_memory_ops, self, 0, "r+b");
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
return stream;
}
@@ -434,7 +434,7 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR
assert(self != NULL);
self->smax = max_memory_usage;
self->mode = mode;
- stream = php_stream_alloc(&php_stream_temp_ops, self, 0, "rwb");
+ stream = php_stream_alloc(&php_stream_temp_ops, self, 0, "r+b");
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
self->innerstream = php_stream_memory_create(mode);
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
index ed4af333ee..95b47b3456 100644
--- a/main/php_open_temporary_file.c
+++ b/main/php_open_temporary_file.c
@@ -149,7 +149,7 @@ static FILE *php_do_open_temporary_file(const char *path, const char *pfx, char
if (fd==-1) {
fp = NULL;
} else {
- fp = fdopen(fd, "wb");
+ fp = fdopen(fd, "r+b");
}
#else
if (mktemp(opened_path)) {
diff --git a/main/streams.c b/main/streams.c
index 43b6ab080f..f18a783471 100755
--- a/main/streams.c
+++ b/main/streams.c
@@ -1236,7 +1236,7 @@ PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char
FILE *fp = php_open_temporary_file(dir, pfx, opened_path TSRMLS_CC);
if (fp) {
- php_stream *stream = php_stream_fopen_from_file_rel(fp, "wb");
+ php_stream *stream = php_stream_fopen_from_file_rel(fp, "r+b");
if (stream) {
return stream;
}