Bug #63195 [Opn->Fbk]: bzread reads 1st block only
| From: | cmb@php.net | Date: | Sun, 05 Jan 2020 10:58:46 +0000 |
| Subject: | Bug #63195 [Opn->Fbk]: bzread reads 1st block only | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224706@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63195&edit=1
ID: 63195
Updated by: cmb@php.net
Reported by: exception0x876 at gmail dot com
Summary: bzread reads 1st block only
-Status: Open
+Status: Feedback
Type: Bug
Package: Bzip2 Related
Operating System: Linux CentOS 5.8
PHP Version: 5.3.17
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[2012-10-02 08:05:41] exception0x876 at gmail dot com
Actually I was wrong about expected result. It should be decompressed data size, not the archive
size.
------------------------------------------------------------------------
[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