cvs: php4 /ext/standard fsock.c /ext/zlib zlib.c zlib_fopen_wrapper.c

From: Date: Sat, 16 Mar 2002 18:42:42 +0000
Subject: cvs: php4 /ext/standard fsock.c /ext/zlib zlib.c zlib_fopen_wrapper.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-10256@lists.php.net to get a copy of this message
wez Sat Mar 16 13:42:42 2002 EDT Modified files: /php4/ext/standard fsock.c /php4/ext/zlib zlib.c zlib_fopen_wrapper.c Log: Fix some issues with gzFile and fsockopen. Index: php4/ext/standard/fsock.c diff -u php4/ext/standard/fsock.c:1.87 php4/ext/standard/fsock.c:1.88 --- php4/ext/standard/fsock.c:1.87 Fri Mar 15 21:33:00 2002 +++ php4/ext/standard/fsock.c Sat Mar 16 13:42:39 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fsock.c,v 1.87 2002/03/16 02:33:00 wez Exp $ */ +/* $Id: fsock.c,v 1.88 2002/03/16 18:42:39 wez Exp $ */ /* converted to PHP Streams and moved much code to main/network.c [wez] */ @@ -159,7 +159,7 @@ ZVAL_STRING(zerrno, "", 1); } - if (port != -1) { /* connect to a host */ + if (port > 0) { /* connect to a host */ enum php_sslflags_t { php_ssl_none, php_ssl_v23, php_ssl_tls }; enum php_sslflags_t ssl_flags; struct { @@ -195,6 +195,11 @@ #endif stream = php_stream_sock_open_host(host, port, socktype, (int)timeout, persistent); + if (stream == NULL) { + zend_error(E_WARNING, "%s(): unable to connect to %s:%d", + get_active_function_name(TSRMLS_C), host, port); + } + #if HAVE_OPENSSL_EXT if (stream) { int ssl_ret = FAILURE; Index: php4/ext/zlib/zlib.c diff -u php4/ext/zlib/zlib.c:1.110 php4/ext/zlib/zlib.c:1.111 --- php4/ext/zlib/zlib.c:1.110 Fri Mar 15 20:37:24 2002 +++ php4/ext/zlib/zlib.c Sat Mar 16 13:42:41 2002 @@ -18,7 +18,7 @@ | Jade Nicoletti <nicoletti@nns.ch> | +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.110 2002/03/16 01:37:24 wez Exp $ */ +/* $Id: zlib.c,v 1.111 2002/03/16 18:42:41 wez Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -257,7 +257,7 @@ stream = php_stream_open_wrapper(path, mode, options | REPORT_ERRORS, NULL TSRMLS_CC); if (stream) { - if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD | PHP_STREAM_CAST_TRY_HARD, (void**)&fd, 1)) + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD|PHP_STREAM_CAST_TRY_HARD, (void**)&fd, 1)) { gzFile ret = gzdopen(fd, mode); if (ret) { @@ -302,8 +302,8 @@ convert_to_string_ex(filename); /* using a stream here is a bit more efficient (resource wise) than php_gzopen_wrapper */ - stream = php_stream_gzopen(Z_STRVAL_PP(filename), "r", use_include_path|ENFORCE_SAFE_MODE, NULL TSRMLS_CC); - if (!stream) { + stream = php_stream_gzopen(Z_STRVAL_PP(filename), "rb", use_include_path|ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL TSRMLS_CC); + if (stream == NULL) { php_error(E_WARNING,"gzFile(\"%s\") - %s",Z_STRVAL_PP(filename),strerror(errno)); RETURN_FALSE; } Index: php4/ext/zlib/zlib_fopen_wrapper.c diff -u php4/ext/zlib/zlib_fopen_wrapper.c:1.12 php4/ext/zlib/zlib_fopen_wrapper.c:1.13 --- php4/ext/zlib/zlib_fopen_wrapper.c:1.12 Sat Mar 16 09:39:51 2002 +++ php4/ext/zlib/zlib_fopen_wrapper.c Sat Mar 16 13:42:42 2002 @@ -15,7 +15,7 @@ | Author: Hartmut Holzgraefe <hartmut@six.de> | +----------------------------------------------------------------------+ */ -/* $Id: zlib_fopen_wrapper.c,v 1.12 2002/03/16 14:39:51 wez Exp $ */ +/* $Id: zlib_fopen_wrapper.c,v 1.13 2002/03/16 18:42:42 wez Exp $ */ #define IS_EXT_MODULE #define _GNU_SOURCE @@ -86,10 +86,9 @@ php_stream *stream = NULL; self = emalloc(sizeof(*self)); - - while(*path != ':') - path++; - path++; + + if (strncmp("zlib:", path, 5) == 0) + path += 5; self->stream = php_stream_open_wrapper(path, mode, options, opened_path TSRMLS_CC);

« previous php.cvs (#10256) next »