php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52486 wrong uncompressed size in append mode
Submitted: 2010-07-29 13:08 UTC Modified: 2010-08-23 17:52 UTC
From: denis at bitrix dot ru Assigned:
Status: Closed Package: Zlib related
PHP Version: 5.2.14 OS: linux
Private report: No CVE-ID: None
 [2010-07-29 13:08 UTC] denis at bitrix dot ru
Description:
------------
The last 4 bytes in GZIP file must contain the size of uncompressed data.
When you write in append mode, php writes just the size of the last chunk.

Test script:
---------------
<?
$str = '0123456789'; // 10 bytes

$f = gzopen('tmp.gz','w');
gzwrite($f, $str);
gzclose($f);

$f = gzopen('tmp.gz','a');
gzwrite($f, $str);
gzclose($f);
?>

# gzip -l tmp.gz

Expected result:
----------------
uncompressed
20

Actual result:
--------------
uncompressed
10

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-23 17:52 UTC] denis at bitrix dot ru
-Status: Open +Status: Closed
 [2010-08-23 17:52 UTC] denis at bitrix dot ru
I was wrong.
This is normal behavior.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC