]> granicus.if.org Git - php/commitdiff
A little extra code to allow overriding plainfiles wrapper as well
authorSara Golemon <pollita@php.net>
Fri, 10 Sep 2004 21:50:29 +0000 (21:50 +0000)
committerSara Golemon <pollita@php.net>
Fri, 10 Sep 2004 21:50:29 +0000 (21:50 +0000)
main/streams/streams.c

index 0e73f320a694dc133784bdd31250e655d11967ce..dfe54fc55030db06466b3c71761da09a8a477f6d 100755 (executable)
@@ -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)) {