|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-08-10 13:11 UTC] cmb@php.net
-Type: Bug
+Type: Documentation Problem
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 10:00:01 2025 UTC |
Description: ------------ After writing to a compress://zlib stream, ftell() reports the number of uncompressed bytes which have been written, not the actual stream position. This is inherently tied to the way the streams layer works: the stream's write method is supposed to return the number of input bytes processed, so the same confusing behavior happens for all streams for which the number of input bytes is not the same as the number of output bytes. Since this cannot easily be fixed, it should at least be documented. Test script: --------------- <?php $s = fopen("compress.zlib://file.gz", "w"); var_dump(fwrite($s, str_repeat("hello world", 100))); fflush($s); // this doesn't make a difference var_dump(ftell($s)); fclose($s); var_dump(filesize("file.gz")); ?> Expected result: ---------------- int(1100) int(38) int(48) Actual result: -------------- int(1100) int(1100) int(48)