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 {
#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;
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) {
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;
}
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);