summaryrefslogtreecommitdiff
path: root/ext/standard/php_fopen_wrapper.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2006-05-01 16:02:07 +0000
committerMarcus Boerger <helly@php.net>2006-05-01 16:02:07 +0000
commit6f1a0f67ff339f91e8e81cc3dfc2f2fd181a9aea (patch)
treea9e697af21c30f9585f1aed705ddfd3798d69c48 /ext/standard/php_fopen_wrapper.c
parent299fe2554f4ef5184a72b146726ea5a7ee62a68b (diff)
downloadphp-git-6f1a0f67ff339f91e8e81cc3dfc2f2fd181a9aea.tar.gz
- Make SplTempFileObject work in 5.1
Diffstat (limited to 'ext/standard/php_fopen_wrapper.c')
-rw-r--r--ext/standard/php_fopen_wrapper.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 69ef2595f3..d3021912b1 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -158,9 +158,29 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch
int mode_rw = 0;
php_stream * stream = NULL;
char *p, *token, *pathdup;
+ long max_memory;
- if (!strncasecmp(path, "php://", 6))
+ if (!strncasecmp(path, "php://", 6)) {
path += 6;
+ }
+
+ if (!strncasecmp(path, "temp", 4)) {
+ path += 4;
+ max_memory = PHP_STREAM_MAX_MEM;
+ if (!strncasecmp(path, "/maxmemory:", 11)) {
+ path += 11;
+ max_memory = strtol(path, NULL, 10);
+ if (max_memory < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Max memory must be >= 0");
+ return NULL;
+ }
+ }
+ return php_stream_temp_create(TEMP_STREAM_DEFAULT, max_memory);
+ }
+
+ if (!strcasecmp(path, "memory")) {
+ return php_stream_memory_create(TEMP_STREAM_DEFAULT);
+ }
if (!strcasecmp(path, "output")) {
return php_stream_alloc(&php_stream_output_ops, NULL, 0, "wb");