From: Wez Furlong Date: Sat, 6 Apr 2002 17:29:39 +0000 (+0000) Subject: Added BC support for old style zlib: wrapper. X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~838 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62538caa862e582523dad0f261c0d8ed6ae0cbf6;p=php Added BC support for old style zlib: wrapper. 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. --- diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c index c345241aa6..2ed6d3b01a 100644 --- a/ext/zlib/zlib_fopen_wrapper.c +++ b/ext/zlib/zlib_fopen_wrapper.c @@ -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); diff --git a/main/streams.c b/main/streams.c index a4c4d7e67b..cc8c8789da 100755 --- a/main/streams.c +++ b/main/streams.c @@ -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; }