pollita         Fri Sep 10 17:50:29 2004 EDT

  Modified files:              
    /php-src/main/streams       streams.c 
  Log:
  A little extra code to allow overriding plainfiles wrapper as well
  
http://cvs.php.net/diff.php/php-src/main/streams/streams.c?r1=1.64&r2=1.65&ty=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.64 php-src/main/streams/streams.c:1.65
--- php-src/main/streams/streams.c:1.64 Fri Sep 10 16:45:35 2004
+++ php-src/main/streams/streams.c      Fri Sep 10 17:50:29 2004
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.64 2004/09/10 20:45:35 pollita Exp $ */
+/* $Id: streams.c,v 1.65 2004/09/10 21:50:29 pollita Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1501,9 +1501,32 @@
 #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)) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to