#48596 [Opn->Fbk]: stream_filter_remove example code does not work

From: Date: Tue, 23 Jun 2009 11:25:59 +0000
Subject: #48596 [Opn->Fbk]: stream_filter_remove example code does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-138692@lists.php.net to get a copy of this message
ID: 48596 Updated by: pajoye@php.net Reported By: php_nospam at ramihyn dot sytes dot net -Status: Open +Status: Feedback Bug Type: Streams related Operating System: Windows XP SP3 PHP Version: 5.3.0RC3 New Comment: Is it windows specific? Previous Comments: ------------------------------------------------------------------------ [2009-06-21 00:26:42] php_nospam at ramihyn dot sytes dot net Still doesn't work for me with RC4. ------------------------------------------------------------------------ [2009-06-20 21:57:13] majkl578 at gmail dot com Sorry, not same, I have 5.3.0RC4 ------------------------------------------------------------------------ [2009-06-20 21:56:24] majkl578 at gmail dot com Same problem as in first post here (code tested). OS: Debian Lenny (unstable) Same PHP version. ------------------------------------------------------------------------ [2009-06-18 17:52:59] php_nospam at ramihyn dot sytes dot net If using the bzip2.compress or zlib.deflate filters, ftell() returns the same value as before using the filter to write to the stream: <?php $s = "The quick brown fox jumps over the lazy dog."; $fp = fopen("test.bin","w"); fwrite($fp,$s); var_dump(ftell($fp)); // int(44) $filter = stream_filter_append($fp,"zlib.deflate",STREAM_FILTER_WRITE,9); fwrite($fp,$s); stream_filter_remove($filter); var_dump(ftell($fp)); // int(44) fclose($fp); ?> ------------------------------------------------------------------------ [2009-06-18 14:54:29] php_nospam at ramihyn dot sytes dot net Also there seems to be a problem with other filters: the below example hangs at fread(), if the script rewind()s the stream. If closing the file and opening a new file handle, everyhing works as expected. <?php $str = "The quick brown fox jumps over the lazy dog."; $fp = fopen("test.bin","w"); $bz_filter = stream_filter_append($fp,"bzip2.compress",9); fwrite($fp,$str,strlen($str)); stream_filter_remove($bz_filter); #fclose($fp); #fopen($fp,"test.bin","r+"); rewind($fp); $bz_filter = stream_filter_append($fp,"bzip2.decompress"); $str2 = fread($fp,strlen($str)); stream_filter_remove($bz_filter); fclose($fp); var_dump($str2); ?> ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/48596 -- Edit this bug report at http://bugs.php.net/?id=48596&edit=1

« previous php.bugs (#138692) next »