]> granicus.if.org Git - php/commitdiff
Fix persistent stream closing (that one took me at least 3 days)
authorMarcus Boerger <helly@php.net>
Sun, 13 Apr 2003 19:47:55 +0000 (19:47 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 13 Apr 2003 19:47:55 +0000 (19:47 +0000)
main/streams/streams.c

index d74cccf1ea7f1a1aa5d788481792f56e4957fc89..e925aac7e5a853f0bc2e09bb2559b91af5b6a83b 100755 (executable)
@@ -238,6 +238,11 @@ fprintf(stderr, "stream_alloc: %s:%p persistent=%s\n", ops->label, ret, persiste
 }
 /* }}} */
 
+int _php_stream_free_persistend(list_entry *le, void *pStream TSRMLS_DC)
+{
+       return le->ptr == pStream;
+}
+
 PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC) /* {{{ */
 {
        int ret = 1;
@@ -364,6 +369,10 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov
 #else
                pefree(stream, stream->is_persistent);
 #endif
+               if (stream->is_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_persistend, stream TSRMLS_CC);
+               }
        }
 
        return ret;