summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/php_memory_streams.h1
-rw-r--r--main/streams/memory.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/main/php_memory_streams.h b/main/php_memory_streams.h
index 4af7745efe..1a9b9000d7 100644
--- a/main/php_memory_streams.h
+++ b/main/php_memory_streams.h
@@ -27,6 +27,7 @@
#define TEMP_STREAM_DEFAULT 0
#define TEMP_STREAM_READONLY 1
+#define TEMP_STREAM_TAKE_BUFFER 2
#define php_stream_memory_create(mode) _php_stream_memory_create((mode) STREAMS_CC TSRMLS_CC)
#define php_stream_memory_create_rel(mode) _php_stream_memory_create((mode) STREAMS_REL_CC TSRMLS_CC)
diff --git a/main/streams/memory.c b/main/streams/memory.c
index a61bd6619e..a9b3f01cb8 100644
--- a/main/streams/memory.c
+++ b/main/streams/memory.c
@@ -237,7 +237,7 @@ PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length ST
if ((stream = php_stream_memory_create_rel(mode)) != NULL) {
ms = stream->abstract;
- if (mode == TEMP_STREAM_READONLY) {
+ if (mode == TEMP_STREAM_READONLY || mode == TEMP_STREAM_TAKE_BUFFER) {
/* use the buffer directly */
ms->data = buf;
ms->fsize = length;