php.net |  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
Votes:2
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: exception0x876 at gmail dot com
New email:
PHP Version: OS:

 

 [2012-10-02 07:57 UTC] 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)

Patches

Pull Requests

History

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] mike@php.net
-Package: *General Issues +Package: Bzip2 Related
 [2020-01-05 10:58 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-01-05 10:58 UTC] cmb@php.net
Do you still experience this issue with an actively supported PHP
version[1] using some recent libbzip2?

[1] <https://www.php.net/supported-versions.php>
 [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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC