summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2004-09-10 21:50:29 +0000
committerSara Golemon <pollita@php.net>2004-09-10 21:50:29 +0000
commited5dcbff9b44c37a3da7077de9493566932e32cc (patch)
tree5cbb4767b3eb31c3c00b39423c20f85da6b8fd94 /main/streams/streams.c
parent955b43ba129fabd10b7d7363a2d92d7ce9c4b228 (diff)
downloadphp-git-ed5dcbff9b44c37a3da7077de9493566932e32cc.tar.gz
A little extra code to allow overriding plainfiles wrapper as well
Diffstat (limited to 'main/streams/streams.c')
-rwxr-xr-xmain/streams/streams.c27
1 files 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)) {