summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-07-29 18:26:34 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-07-29 18:26:34 +0000
commit4d98e9ec970ed72848c82f7ed0fe7060ad37f66d (patch)
tree68f321d17dd025f0b430f45bb69810c86823723e /main/streams/streams.c
parent7b18132dbab996cd4a7962907e45a2925ca3544d (diff)
downloadphp-git-4d98e9ec970ed72848c82f7ed0fe7060ad37f66d.tar.gz
Finalize the closing process of persistent streams. The current
behavior/API is as follows: 1) To close a persistent use php_stream_pclose(), it will close the stream and remove it from the persistent list. 2) Inside PHP code only explicit fclose() will close persistent streams, all other actions such as unset() or assigning a value to stream handle will not. 3) Regular streams can still be closed by either fclose(), unset() or an assignment of a value to the stream handler.
Diffstat (limited to 'main/streams/streams.c')
-rwxr-xr-xmain/streams/streams.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 4b948c0bc7..6f580dc986 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -254,7 +254,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)
{
- return (le->ptr == pStream && !((php_stream *)pStream)->in_free);
+ return le->ptr == pStream;
}
PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC) /* {{{ */
@@ -358,7 +358,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
stream->readbuf = NULL;
}
- if (stream->is_persistent) {
+ if (stream->is_persistent && (close_options & PHP_STREAM_FREE_PERSISTENT)) {
/* we don't work with *stream but need its value for comparison */
zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) _php_stream_free_persistent, stream TSRMLS_CC);
}