cvs: php4 /ext/zlib zlib_fopen_wrapper.c /main streams.c

From: Date: Sat, 06 Apr 2002 17:29:39 +0000
Subject: cvs: php4 /ext/zlib zlib_fopen_wrapper.c /main streams.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-10931@lists.php.net to get a copy of this message
wez Sat Apr 6 12:29:39 2002 EDT Modified files: /php4/main streams.c /php4/ext/zlib zlib_fopen_wrapper.c Log: 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. Index: php4/main/streams.c diff -u php4/main/streams.c:1.45 php4/main/streams.c:1.46 --- php4/main/streams.c:1.45 Tue Apr 2 11:46:33 2002 +++ php4/main/streams.c Sat Apr 6 12:29:38 2002 @@ -1081,10 +1081,24 @@ 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; } Index: php4/ext/zlib/zlib_fopen_wrapper.c diff -u php4/ext/zlib/zlib_fopen_wrapper.c:1.22 php4/ext/zlib/zlib_fopen_wrapper.c:1.23 --- php4/ext/zlib/zlib_fopen_wrapper.c:1.22 Wed Mar 27 19:48:59 2002 +++ php4/ext/zlib/zlib_fopen_wrapper.c Sat Apr 6 12:29:39 2002 @@ -16,7 +16,7 @@ | Hartmut Holzgraefe <hartmut@six.de> | +----------------------------------------------------------------------+ */ -/* $Id: zlib_fopen_wrapper.c,v 1.22 2002/03/28 00:48:59 wez Exp $ */ +/* $Id: zlib_fopen_wrapper.c,v 1.23 2002/04/06 17:29:39 wez Exp $ */ #define IS_EXT_MODULE #define _GNU_SOURCE @@ -102,6 +102,8 @@ 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);

« previous php.cvs (#10931) next »