From:             exception0x876 at gmail dot com
Operating system: Linux CentOS 5.8
PHP version:      5.3.17
Package:          *General Issues
Bug Type:         Bug
Bug description:bzread reads 1st block only

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 bug report at https://bugs.php.net/bug.php?id=63195&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63195&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63195&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63195&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63195&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63195&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63195&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63195&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63195&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63195&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63195&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63195&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63195&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63195&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63195&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63195&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63195&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63195&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63195&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63195&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63195&r=mysqlcfg

Reply via email to