]> granicus.if.org Git - php/commitdiff
Added BC support for old style zlib: wrapper.
authorWez Furlong <wez@php.net>
Sat, 6 Apr 2002 17:29:39 +0000 (17:29 +0000)
committerWez Furlong <wez@php.net>
Sat, 6 Apr 2002 17:29:39 +0000 (17:29 +0000)
Added notice when a requested wrapper is not found.
# This BC thing was giving me nightmares.
# It took me 10 minutes to realize I hadn't compiled in zlib support also.

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

index c345241aa6697d0e87c415e991818206c34df4f1..2ed6d3b01a65e15c87301ad81c1bb5234630aecd 100644 (file)
@@ -102,6 +102,8 @@ php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mod
 
        if (strncasecmp("zlib://", path, 7) == 0)
                path += 7;
+       else if (strncasecmp("zlib:", path, 5) == 0)
+               path += 5;
        
        self->stream = php_stream_open_wrapper(path, mode, STREAM_MUST_SEEK|options, opened_path);
        
index a4c4d7e67bcc1a277565da357c9a0fa7e47a0bb4..cc8c8789da82de6008a1bcbac91652a6201dc22a 100755 (executable)
@@ -1081,10 +1081,24 @@ static php_stream *php_stream_open_url(char *path, char *mode, int options, char
 
        if ((*p == ':') && (n > 1) && !strncmp("://", p, 3)) {
                protocol = path;
+       } else if (strncasecmp(path, "zlib:", 5) == 0) {
+               /* BC with older php scripts and zlib wrapper */
+               protocol = path;
+               n = 4;
+               zend_error(E_NOTICE, "Use of \"zlib:\" wrapper is deprecated; please use \"zlib://\" instead.");
        }
 
        if (protocol)   {
                if (FAILURE == zend_hash_find(&url_stream_wrappers_hash, (char*)protocol, n, (void**)&wrapper)) {
+                       char wrapper_name[32];
+
+                       if (n >= sizeof(wrapper_name))
+                               n = sizeof(wrapper_name) - 1;
+                       PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n);
+                       
+                       zend_error(E_NOTICE, "Unable to find the wrapper \"%s\" - did you forget to enable it when you configured PHP?",
+                                       wrapper_name);
+
                        wrapper = NULL;
                        protocol = NULL;
                }