ID:               48596
 Comment by:       majkl578 at gmail dot com
 Reported By:      php_nospam at ramihyn dot sytes dot net
 Status:           Open
 Bug Type:         Streams related
 Operating System: Windows XP SP3
 PHP Version:      5.3.0RC3
 New Comment:

Sorry, not same, I have 5.3.0RC4


Previous Comments:
------------------------------------------------------------------------

[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);
?>

------------------------------------------------------------------------

[2009-06-18 14:49:33] php_nospam at ramihyn dot sytes dot net

Description:
------------
The example provided for stream_filter_remove() does not work as
expected.

Reproduce code:
---------------
<?php
$fp = fopen("test.txt", "w");

$rot13_filter = stream_filter_append($fp, "string.rot13",
STREAM_FILTER_WRITE);
fwrite($fp, "This is ");
stream_filter_remove($rot13_filter);
fwrite($fp, "a test\n");

rewind($fp);
fpassthru($fp);
fclose($fp);

?>

Expected result:
----------------
Guvf vf a test

Actual result:
--------------
(no output)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48596&edit=1

Reply via email to