|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63195 bzread reads 1st block only
Submitted: 2012-10-02 07:57 UTC Modified: 2020-01-19 04:22 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: exception0x876 at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: Bzip2 Related
PHP Version: 5.3.17 OS: Linux CentOS 5.8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: exception0x876 at gmail dot com
New email:
PHP Version: OS:


 [2012-10-02 07:57 UTC] exception0x876 at gmail dot com
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:
$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");

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-02 08:05 UTC] exception0x876 at gmail dot com
Actually I was wrong about expected result. It should be decompressed data size, not the archive size.
 [2013-12-05 16:59 UTC]
-Package: *General Issues +Package: Bzip2 Related
 [2020-01-05 10:58 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-01-05 10:58 UTC]
Do you still experience this issue with an actively supported PHP
version[1] using some recent libbzip2?

[1] <>
 [2020-01-19 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 23 15:01:24 2023 UTC