summaryrefslogtreecommitdiff
path: root/ext/standard/php_fopen_wrapper.c
diff options
context:
space:
mode:
authorArnaud Le Blanc <lbarnaud@php.net>2008-11-11 00:44:55 +0000
committerArnaud Le Blanc <lbarnaud@php.net>2008-11-11 00:44:55 +0000
commitf6345133b39a3c951ef267985dfe3c5f20cff2c5 (patch)
tree0173ae61aeb89439dcedc6ee9cf337bdac694ca9 /ext/standard/php_fopen_wrapper.c
parentdcdf00bdfca5d432998ac9fdf17f36212368d4ff (diff)
downloadphp-git-f6345133b39a3c951ef267985dfe3c5f20cff2c5.tar.gz
MFH: Fixed bug #44818 (php://memory writeable when opened read only)
Diffstat (limited to 'ext/standard/php_fopen_wrapper.c')
-rw-r--r--ext/standard/php_fopen_wrapper.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 3d380344a9..a7c685a580 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -177,11 +177,21 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch
return NULL;
}
}
- return php_stream_temp_create(TEMP_STREAM_DEFAULT, max_memory);
+ if (strpbrk(mode, "wa+")) {
+ mode_rw = TEMP_STREAM_DEFAULT;
+ } else {
+ mode_rw = TEMP_STREAM_READONLY;
+ }
+ return php_stream_temp_create(mode_rw, max_memory);
}
if (!strcasecmp(path, "memory")) {
- return php_stream_memory_create(TEMP_STREAM_DEFAULT);
+ if (strpbrk(mode, "wa+")) {
+ mode_rw = TEMP_STREAM_DEFAULT;
+ } else {
+ mode_rw = TEMP_STREAM_READONLY;
+ }
+ return php_stream_memory_create(mode_rw);
}
if (!strcasecmp(path, "output")) {