summaryrefslogtreecommitdiff
path: root/main/streams
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams')
-rw-r--r--main/streams/cast.c8
-rw-r--r--main/streams/filter.c12
-rw-r--r--main/streams/memory.c77
-rw-r--r--main/streams/mmap.c8
-rw-r--r--main/streams/php_stream_context.h8
-rw-r--r--main/streams/php_stream_filter_api.h8
-rw-r--r--main/streams/php_stream_mmap.h8
-rw-r--r--main/streams/php_stream_plain_wrapper.h8
-rw-r--r--main/streams/php_stream_transport.h8
-rw-r--r--main/streams/php_stream_userspace.h8
-rw-r--r--main/streams/php_streams_int.h8
-rw-r--r--main/streams/plain_wrapper.c10
-rwxr-xr-xmain/streams/streams.c20
-rw-r--r--main/streams/transports.c8
-rw-r--r--main/streams/userspace.c12
-rw-r--r--main/streams/xp_socket.c8
16 files changed, 129 insertions, 90 deletions
diff --git a/main/streams/cast.c b/main/streams/cast.c
index 1509ff407..ac185aa5a 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cast.c,v 1.12 2005/08/03 14:08:40 sniper Exp $ */
+/* $Id: cast.c,v 1.12.2.1 2006/01/01 12:50:18 sniper Exp $ */
#define _GNU_SOURCE
#include "php.h"
diff --git a/main/streams/filter.c b/main/streams/filter.c
index abe8d7e7b..1e9fc334e 100644
--- a/main/streams/filter.c
+++ b/main/streams/filter.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter.c,v 1.17 2005/08/03 14:08:40 sniper Exp $ */
+/* $Id: filter.c,v 1.17.2.2 2006/01/10 16:14:16 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -204,6 +204,10 @@ PHPAPI void php_stream_bucket_prepend(php_stream_bucket_brigade *brigade, php_st
PHPAPI void php_stream_bucket_append(php_stream_bucket_brigade *brigade, php_stream_bucket *bucket TSRMLS_DC)
{
+ if (brigade->tail == bucket) {
+ return;
+ }
+
bucket->prev = brigade->tail;
bucket->next = NULL;
diff --git a/main/streams/memory.c b/main/streams/memory.c
index 387d19cd2..c15d8205c 100644
--- a/main/streams/memory.c
+++ b/main/streams/memory.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: memory.c,v 1.8.2.2 2005/10/07 07:38:59 helly Exp $ */
+/* $Id: memory.c,v 1.8.2.5 2006/01/05 22:03:07 helly Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -39,6 +39,7 @@ typedef struct {
size_t fsize;
size_t smax;
int mode;
+ php_stream **owner_ptr;
} php_stream_memory_data;
@@ -118,6 +119,9 @@ static int php_stream_memory_close(php_stream *stream, int close_handle TSRMLS_D
if (ms->data && close_handle && ms->mode != TEMP_STREAM_READONLY) {
efree(ms->data);
}
+ if (ms->owner_ptr) {
+ *ms->owner_ptr = NULL;
+ }
efree(ms);
return 0;
}
@@ -147,44 +151,51 @@ static int php_stream_memory_seek(php_stream *stream, off_t offset, int whence,
if (offset < 0) {
if (ms->fpos < (size_t)(-offset)) {
ms->fpos = 0;
- /*return EINVAL;*/
+ *newoffs = -1;
+ return -1;
} else {
ms->fpos = ms->fpos + offset;
+ *newoffs = ms->fpos;
+ return 0;
}
} else {
if (ms->fpos < (size_t)(offset)) {
ms->fpos = ms->fsize;
- /*return EINVAL;*/
+ *newoffs = -1;
+ return -1;
} else {
ms->fpos = ms->fpos + offset;
+ *newoffs = ms->fpos;
+ return 0;
}
}
- *newoffs = ms->fpos;
- return 0;
case SEEK_SET:
if (ms->fsize < (size_t)(offset)) {
ms->fpos = ms->fsize;
- /*return EINVAL;*/
+ *newoffs = -1;
+ return -1;
} else {
ms->fpos = offset;
+ *newoffs = ms->fpos;
+ return 0;
}
- *newoffs = ms->fpos;
- return 0;
case SEEK_END:
if (offset > 0) {
ms->fpos = ms->fsize;
- /*return EINVAL;*/
- } else if (ms->fpos < (size_t)(-offset)) {
+ *newoffs = -1;
+ return -1;
+ } else if (ms->fsize < (size_t)(-offset)) {
ms->fpos = 0;
- /*return EINVAL;*/
+ *newoffs = -1;
+ return -1;
} else {
ms->fpos = ms->fsize + offset;
+ *newoffs = ms->fpos;
+ return 0;
}
- *newoffs = ms->fpos;
- return 0;
default:
- return 0;
- /*return EINVAL;*/
+ *newoffs = ms->fpos;
+ return -1;
}
}
/* }}} */
@@ -220,8 +231,9 @@ PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC)
self->fsize = 0;
self->smax = -1;
self->mode = mode;
+ self->owner_ptr = NULL;
- stream = php_stream_alloc(&php_stream_memory_ops, self, 0, "r+b");
+ stream = php_stream_alloc(&php_stream_memory_ops, self, 0, mode & TEMP_STREAM_READONLY ? "r+b" : "w+b");
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
return stream;
}
@@ -288,6 +300,9 @@ static size_t php_stream_temp_write(php_stream *stream, const char *buf, size_t
ts = stream->abstract;
assert(ts != NULL);
+ if (!ts->innerstream) {
+ return -1;
+ }
if (php_stream_is(ts->innerstream, PHP_STREAM_IS_MEMORY)) {
size_t memsize;
char *membuf = php_stream_memory_get_buffer(ts->innerstream, &memsize);
@@ -314,6 +329,10 @@ static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count T
ts = stream->abstract;
assert(ts != NULL);
+ if (!ts->innerstream) {
+ return -1;
+ }
+
got = php_stream_read(ts->innerstream, buf, count);
if (!got) {
@@ -335,7 +354,11 @@ static int php_stream_temp_close(php_stream *stream, int close_handle TSRMLS_DC)
ts = stream->abstract;
assert(ts != NULL);
- ret = php_stream_free(ts->innerstream, PHP_STREAM_FREE_CLOSE | (close_handle ? 0 : PHP_STREAM_FREE_PRESERVE_HANDLE));
+ if (ts->innerstream) {
+ ret = php_stream_free(ts->innerstream, PHP_STREAM_FREE_CLOSE | (close_handle ? 0 : PHP_STREAM_FREE_PRESERVE_HANDLE));
+ } else {
+ ret = 0;
+ }
efree(ts);
@@ -353,7 +376,7 @@ static int php_stream_temp_flush(php_stream *stream TSRMLS_DC)
ts = stream->abstract;
assert(ts != NULL);
- return php_stream_flush(ts->innerstream);
+ return ts->innerstream ? php_stream_flush(ts->innerstream) : -1;
}
/* }}} */
@@ -368,6 +391,10 @@ static int php_stream_temp_seek(php_stream *stream, off_t offset, int whence, of
ts = stream->abstract;
assert(ts != NULL);
+ if (!ts->innerstream) {
+ *newoffs = -1;
+ return -1;
+ }
ret = php_stream_seek(ts->innerstream, offset, whence);
*newoffs = php_stream_tell(ts->innerstream);
@@ -388,6 +415,9 @@ static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRML
ts = stream->abstract;
assert(ts != NULL);
+ if (!ts->innerstream) {
+ return FAILURE;
+ }
if (php_stream_is(ts->innerstream, PHP_STREAM_IS_STDIO)) {
return php_stream_cast(ts->innerstream, castas, ret, 0);
}
@@ -441,9 +471,10 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR
self = ecalloc(1, sizeof(*self));
self->smax = max_memory_usage;
self->mode = mode;
- stream = php_stream_alloc(&php_stream_temp_ops, self, 0, "r+b");
+ stream = php_stream_alloc(&php_stream_temp_ops, self, 0, mode & TEMP_STREAM_READONLY ? "r+b" : "w+b");
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER;
self->innerstream = php_stream_memory_create(mode);
+ ((php_stream_memory_data*)self->innerstream->abstract)->owner_ptr = &self->innerstream;
return stream;
}
@@ -456,7 +487,7 @@ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char
php_stream *stream;
php_stream_temp_data *ms;
- if ((stream = php_stream_temp_create_rel(mode & ~TEMP_STREAM_READONLY, max_memory_usage)) != NULL) {
+ if ((stream = php_stream_temp_create_rel(mode, max_memory_usage)) != NULL) {
if (length) {
assert(buf != NULL);
php_stream_temp_write(stream, buf, length TSRMLS_CC);
diff --git a/main/streams/mmap.c b/main/streams/mmap.c
index f594f741f..81642353b 100644
--- a/main/streams/mmap.c
+++ b/main/streams/mmap.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mmap.c,v 1.8 2005/08/03 14:08:42 sniper Exp $ */
+/* $Id: mmap.c,v 1.8.2.1 2006/01/01 12:50:18 sniper Exp $ */
/* Memory Mapping interface for streams */
#include "php.h"
diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
index 93b152a13..d840944af 100644
--- a/main/streams/php_stream_context.h
+++ b/main/streams/php_stream_context.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_context.h,v 1.11 2005/08/03 14:08:42 sniper Exp $ */
+/* $Id: php_stream_context.h,v 1.11.2.1 2006/01/01 12:50:18 sniper Exp $ */
/* Stream context and status notification related definitions */
diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h
index 9c4c71c64..6f40a1d4b 100644
--- a/main/streams/php_stream_filter_api.h
+++ b/main/streams/php_stream_filter_api.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_filter_api.h,v 1.13 2005/08/03 14:08:42 sniper Exp $ */
+/* $Id: php_stream_filter_api.h,v 1.13.2.1 2006/01/01 12:50:18 sniper Exp $ */
/* The filter API works on the principle of "Bucket-Brigades". This is
* partially inspired by the Apache 2 method of doing things, although
diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h
index 011dc318c..407bbfcd8 100644
--- a/main/streams/php_stream_mmap.h
+++ b/main/streams/php_stream_mmap.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_mmap.h,v 1.5 2005/08/03 14:08:42 sniper Exp $ */
+/* $Id: php_stream_mmap.h,v 1.5.2.1 2006/01/01 12:50:18 sniper Exp $ */
/* Memory Mapping interface for streams.
* The intention is to provide a uniform interface over the most common
diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h
index 8063f9457..9c310e343 100644
--- a/main/streams/php_stream_plain_wrapper.h
+++ b/main/streams/php_stream_plain_wrapper.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_plain_wrapper.h,v 1.7.2.1 2005/10/22 17:02:10 wez Exp $ */
+/* $Id: php_stream_plain_wrapper.h,v 1.7.2.2 2006/01/01 12:50:18 sniper Exp $ */
/* definitions for the plain files wrapper */
diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h
index c7b9e48b8..d8433831f 100644
--- a/main/streams/php_stream_transport.h
+++ b/main/streams/php_stream_transport.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_transport.h,v 1.10 2005/08/03 14:08:42 sniper Exp $ */
+/* $Id: php_stream_transport.h,v 1.10.2.1 2006/01/01 12:50:18 sniper Exp $ */
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
diff --git a/main/streams/php_stream_userspace.h b/main/streams/php_stream_userspace.h
index eda07acc7..f7acf113b 100644
--- a/main/streams/php_stream_userspace.h
+++ b/main/streams/php_stream_userspace.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_stream_userspace.h,v 1.5 2005/08/03 14:08:42 sniper Exp $ */
+/* $Id: php_stream_userspace.h,v 1.5.2.1 2006/01/01 12:50:18 sniper Exp $ */
/* for user-space streams */
diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h
index a2078d7ae..30567d1a4 100644
--- a/main/streams/php_streams_int.h
+++ b/main/streams/php_streams_int.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_streams_int.h,v 1.7 2005/08/03 14:08:42 sniper Exp $ */
+/* $Id: php_streams_int.h,v 1.7.2.1 2006/01/01 12:50:18 sniper Exp $ */
#if ZEND_DEBUG
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index f52fae273..1fc2e982f 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c,v 1.52.2.2 2005/11/17 14:19:40 tony2001 Exp $ */
+/* $Id: plain_wrapper.c,v 1.52.2.4 2006/01/01 12:50:18 sniper Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -316,7 +316,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
if (data->fd >= 0) {
ret = read(data->fd, buf, count);
- stream->eof = (ret == 0 || (ret == -1 && errno != EWOULDBLOCK));
+ stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK));
} else {
#if HAVE_FLUSHIO
diff --git a/main/streams/streams.c b/main/streams/streams.c
index f0b35b2d2..b50bc70fc 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.82 2005/08/03 14:08:43 sniper Exp $ */
+/* $Id: streams.c,v 1.82.2.4 2006/01/01 12:50:18 sniper Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -65,7 +65,7 @@ PHPAPI HashTable *php_stream_get_url_stream_wrappers_hash_global(void)
return &url_stream_wrappers_hash;
}
-static int _php_stream_release_context(list_entry *le, void *pContext TSRMLS_DC)
+static int _php_stream_release_context(zend_rsrc_list_entry *le, void *pContext TSRMLS_DC)
{
if (le->ptr == pContext) {
return --le->refcount == 0;
@@ -267,7 +267,7 @@ fprintf(stderr, "stream_alloc: %s:%p persistent=%s\n", ops->label, ret, persiste
}
/* }}} */
-static int _php_stream_free_persistent(list_entry *le, void *pStream TSRMLS_DC)
+static int _php_stream_free_persistent(zend_rsrc_list_entry *le, void *pStream TSRMLS_DC)
{
return le->ptr == pStream;
}
@@ -442,7 +442,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D
/* read a chunk into a bucket */
justread = stream->ops->read(stream, chunk_buf, stream->chunk_size TSRMLS_CC);
- if (justread > 0) {
+ if (justread != (size_t)-1) {
bucket = php_stream_bucket_new(stream, chunk_buf, justread, 0, 0 TSRMLS_CC);
/* after this call, bucket is owned by the brigade */
@@ -511,7 +511,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D
break;
}
- if (justread == 0) {
+ if (justread == 0 || justread == (size_t)-1) {
break;
}
}
@@ -1831,6 +1831,10 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
if (stream == NULL && (options & REPORT_ERRORS)) {
php_stream_display_wrapper_errors(wrapper, path, "failed to open stream" TSRMLS_CC);
+ if (opened_path && *opened_path) {
+ efree(*opened_path);
+ *opened_path = NULL;
+ }
}
php_stream_tidy_wrapper_error_log(wrapper TSRMLS_CC);
#if ZEND_DEBUG
diff --git a/main/streams/transports.c b/main/streams/transports.c
index ab7dd250f..c0ec5ec1d 100644
--- a/main/streams/transports.c
+++ b/main/streams/transports.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: transports.c,v 1.16 2005/08/03 14:08:43 sniper Exp $ */
+/* $Id: transports.c,v 1.16.2.1 2006/01/01 12:50:18 sniper Exp $ */
#include "php.h"
#include "php_streams_int.h"
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index 17935151b..d1e3edc1b 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: userspace.c,v 1.31 2005/08/03 14:08:43 sniper Exp $ */
+/* $Id: userspace.c,v 1.31.2.2 2006/01/01 12:50:18 sniper Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -437,7 +437,7 @@ PHP_FUNCTION(stream_wrapper_register)
}
/* }}} */
-/* {{{ bool stream_wrapper_unregister(string protocol)
+/* {{{ proto bool stream_wrapper_unregister(string protocol)
Unregister a wrapper for the life of the current request. */
PHP_FUNCTION(stream_wrapper_unregister)
{
@@ -458,7 +458,7 @@ PHP_FUNCTION(stream_wrapper_unregister)
}
/* }}} */
-/* {{{ bool stream_wrapper_restore(string protocol)
+/* {{{ proto bool stream_wrapper_restore(string protocol)
Restore the original protocol handler, overriding if necessary */
PHP_FUNCTION(stream_wrapper_restore)
{
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 1037a1e71..f3aa94913 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xp_socket.c,v 1.33 2005/08/03 14:08:43 sniper Exp $ */
+/* $Id: xp_socket.c,v 1.33.2.1 2006/01/01 12:50:18 sniper Exp $ */
#include "php.h"
#include "ext/standard/file.h"