From:             [EMAIL PROTECTED]
Operating system: 
PHP version:      5.3CVS-2008-09-24 (CVS)
PHP Bug Type:     Streams related
Bug description:  stream_filter_remove() closes the stream

Description:
------------
Calling stream_filter_remove() closes the stream when the filter is a user
filter.

Reproduce code:
---------------
class user_filter extends php_user_filter {
        function filter($in, $out, &$consumed, $closing) {
                while($bucket = stream_bucket_make_writeable($in)) {
                        $consumed += $bucket->datalen;
                        stream_bucket_append($out, $bucket);
                }
                return PSFS_PASS_ON;
        }
}
stream_filter_register('user_filter','user_filter');

$fd = fopen('/tmp/test','w');
$filter = stream_filter_append($fd, 'user_filter');
stream_filter_remove($filter);
var_dump(fclose($fd));

Expected result:
----------------
bool(true)

Actual result:
--------------
Warning: fclose(): 5 is not a valid stream resource in /tmp/rep.php on
line 15
bool(false)

-- 
Edit bug report at http://bugs.php.net/?id=46164&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=46164&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=46164&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=46164&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46164&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=46164&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46164&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46164&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46164&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46164&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46164&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=46164&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=46164&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46164&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46164&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46164&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46164&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46164&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46164&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46164&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46164&r=mysqlcfg

Reply via email to