From ed5dcbff9b44c37a3da7077de9493566932e32cc Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Fri, 10 Sep 2004 21:50:29 +0000 Subject: [PATCH] A little extra code to allow overriding plainfiles wrapper as well --- main/streams/streams.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/main/streams/streams.c b/main/streams/streams.c index 0e73f320a6..dfe54fc550 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1501,9 +1501,32 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char #endif (*path_for_open)--; } + + if (options & STREAM_LOCATE_WRAPPERS_ONLY) { + return NULL; + } - /* fall back on regular file access */ - return (options & STREAM_LOCATE_WRAPPERS_ONLY) ? NULL : &php_plain_files_wrapper; + if (FG(stream_wrappers)) { + /* The file:// wrapper may have been disabled/overridden */ + + if (wrapper) { + /* It was found so go ahead and provide it */ + return wrapper; + } + + /* Check again, the original check might have not known the protocol name */ + if (zend_hash_find(wrapper_hash, "file", sizeof("file")-1, (void**)&wrapper) == SUCCESS) { + return wrapper; + } + + if (options & REPORT_ERRORS) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Plainfiles wrapper disabled"); + } + return NULL; + } + + /* fall back on regular file access */ + return &php_plain_files_wrapper; } if (wrapper && wrapper->is_url && !PG(allow_url_fopen)) { -- 2.50.1