-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #81302: Stream position after stream filter removed
When flushing the stream filters actually causes data to be written to the stream, we need to update its position, because that is not done by the streams' write methods. Closes GH-7354.
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
Bug #81302 (Stream position after stream filter removed) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('zlib')) die("skip zlib extension not available"); | ||
?> | ||
--FILE-- | ||
<?php | ||
$f = fopen("php://memory", "w+b"); | ||
$z = stream_filter_append($f, "zlib.deflate", STREAM_FILTER_WRITE, 6); | ||
fwrite($f, "Testing"); | ||
stream_filter_remove($z); | ||
$pos = ftell($f); | ||
fseek($f, 0); | ||
$count = strlen(fread($f, 1024)); | ||
fclose($f); | ||
var_dump($count === $pos); | ||
?> | ||
--EXPECT-- | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters