Doc #81345 [Com]: ftell() after writing to compress://zlib stream wrong

From: Date: Fri, 03 Sep 2021 16:12:52 +0000
Subject: Doc #81345 [Com]: ftell() after writing to compress://zlib stream wrong
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-19155@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81345&edit=1

 ID:                 81345
 Comment by:         southescort dot info at gmail dot com
 Reported by:        cmb@php.net
 Summary:            ftell() after writing to compress://zlib stream
                     wrong
 Status:             Open
 Type:               Documentation Problem
 Package:            Streams related
 Operating System:   *
 PHP Version:        7.4Git-2021-08-10 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

The escorts service Bangalore is a group of young, beautiful, and passionate women who are waiting
to share the best moments with you. They provide escort services in Bangalore on all occasions:
parties, business meetings, dances, or just for fun. We want to be your partner and friend so we can
show you what it means to enjoy life!

https://neverendservices.wixsite.com/escortsbangalore
https://neverendservices.wixsite.com/bangaloreescorts
https://neverendservices.wixsite.com/bangalore-escorts


Previous Comments:
------------------------------------------------------------------------
[2021-08-10 13:11:03] cmb@php.net

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)



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



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


Thread (4 messages)

« previous php.doc.bugs (#19155) next »