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

 ID:                 63195
 Comment by:         exception0x876 at gmail dot com
 Reported by:        exception0x876 at gmail dot com
 Summary:            bzread reads 1st block only
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   Linux CentOS 5.8
 PHP Version:        5.3.17
 Block user comment: N
 Private report:     N

 New Comment:

Actually I was wrong about expected result. It should be decompressed data 
size, not the archive size.


Previous Comments:
------------------------------------------------------------------------
[2012-10-02 07:57:55] exception0x876 at gmail dot com

Description:
------------
It seems bzread reads only the 1st block of that specific archive.

The archive size is:
ls -l test.bz2 
-rw-r--r-- 1 1000 users 2082194364 Oct  1 07:21 test.bz2

I can extract the archive just fine with system bzip2.

Test script:
---------------
<?php
$filename = 'test.bz2';
$uncompressed = '';
$fp = bzopen($filename, 'r');
if (!$fp)
die("Could not open $filename\n");
$size = 0;
while (!feof($fp)) {
$buf = bzread($fp, 4096);
$size+= strlen($buf);
if ($buf === false)
die("File read problem\n");
$arr = bzerror($fp);
if ($arr['errno'] !== 0)
die("Compression problem ".$arr['errstr']."\n");
}
var_dump($size);
bzclose($fp);

Expected result:
----------------
int(2082194364)

Actual result:
--------------
int(900000)


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



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

Reply via email to