diff options
author | Adam Saponara <as@php.net> | 2017-08-04 01:59:22 -0400 |
---|---|---|
committer | Joe Watkins <krakjoe@php.net> | 2017-08-04 12:43:49 +0100 |
commit | db96b7c245907ef533c9dd7dc226b839df1a9341 (patch) | |
tree | e2acc875f77b4846cac584e97e0639789aa3598b /ext/standard/php_fopen_wrapper.c | |
parent | a1a949d89c86c9687346b9e5e245b8a36333d0f1 (diff) | |
download | php-git-db96b7c245907ef533c9dd7dc226b839df1a9341.tar.gz |
Fix #75031: Support append mode in `php://temp` streams
This patch introduces a distinction between write mode and append
mode in `php://temp` and `php://memory` streams, achieving parity
with C stdio.
Diffstat (limited to 'ext/standard/php_fopen_wrapper.c')
-rw-r--r-- | ext/standard/php_fopen_wrapper.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 0031440704..34f5d3afbf 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -28,6 +28,7 @@ #include "php.h" #include "php_globals.h" #include "php_standard.h" +#include "php_memory_streams.h" #include "php_fopen_wrappers.h" #include "SAPI.h" @@ -203,20 +204,12 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa return NULL; } } - if (strpbrk(mode, "wa+")) { - mode_rw = TEMP_STREAM_DEFAULT; - } else { - mode_rw = TEMP_STREAM_READONLY; - } + mode_rw = php_stream_mode_from_str(mode); return php_stream_temp_create(mode_rw, max_memory); } if (!strcasecmp(path, "memory")) { - if (strpbrk(mode, "wa+")) { - mode_rw = TEMP_STREAM_DEFAULT; - } else { - mode_rw = TEMP_STREAM_READONLY; - } + mode_rw = php_stream_mode_from_str(mode); return php_stream_memory_create(mode_rw); } |