]> granicus.if.org Git - php/commitdiff
Require that wrappers use <protocol>://<path> to avoid
authorWez Furlong <wez@php.net>
Thu, 21 Mar 2002 17:02:50 +0000 (17:02 +0000)
committerWez Furlong <wez@php.net>
Thu, 21 Mar 2002 17:02:50 +0000 (17:02 +0000)
ambiguities when filenames have ':' characters.
This slightly breaks BC with the old style zlib: wrapper.

ext/standard/php_fopen_wrapper.c
ext/zlib/zlib_fopen_wrapper.c
main/streams.c

index 8677486c52bbcd1815c22b86947ab438ccb9627a..19aa15a2e41f1189da571227199e1a129b077708 100644 (file)
@@ -34,6 +34,9 @@ php_stream * php_stream_url_wrap_php(char * path, char * mode, int options, char
 {
        FILE * fp = NULL;
        php_stream * stream = NULL;
+
+       if (!strncasecmp(path, "php://", 6))
+               path += 6;
        
        if (!strcasecmp(path, "stdin")) {
                fp = fdopen(dup(STDIN_FILENO), mode);
index a12abf19962944beb04ecccedc3c9ec64b5da384..434719dae5a18f4115bda59d5162f556dbbcfd28 100644 (file)
@@ -99,8 +99,8 @@ php_stream *php_stream_gzopen(char *path, char *mode, int options, char **opened
        
        self = emalloc(sizeof(*self));
 
-       if (strncmp("zlib:", path, 5) == 0)
-               path += 5;
+       if (strncasecmp("zlib://", path, 7) == 0)
+               path += 7;
        
        self->stream = php_stream_open_wrapper(path, mode, STREAM_MUST_SEEK|options, opened_path);
        
index a02e4c7f7e5ec42fe8cc80920bf9bf3b50976657..0a0f3a32e2e648965f13e800f6db7ef62f110ca0 100755 (executable)
@@ -1029,7 +1029,7 @@ static php_stream *php_stream_open_url(char *path, char *mode, int options, char
                n++;
        }
 
-       if ((*p == ':') && (n > 1)) {
+       if ((*p == ':') && (n > 1) && !strncmp("://", p, 3)) {
                protocol = path;
        }