|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69750 getStream() partial extract 4MB only
Submitted: 2015-06-03 09:39 UTC Modified: 2017-07-30 04:22 UTC
Avg. Score:4.2 ± 1.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:3 (75.0%)
From: vangog at gmail dot com Assigned: cataphract (profile)
Status: No Feedback Package: rar (PECL)
PHP Version: 5.4.41 OS: Debian 3.2.68-1+deb7u1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-06-03 09:39 UTC] vangog at gmail dot com
getStream() return stream, which allows to read only (4194304) 4MB data. 
The same entry can be successfully extracted to disk using extract() method. 
Archive was tested on different OS, file was extracted using different software all is ok. This second time I'm reporting this because noticed magic number 4194304 which clearly indicates a bug. 

Also uploaded original file to Google Drive. 

Test script:

$remote_path = '';
$local_path = sys_get_temp_dir().DIRECTORY_SEPARATOR.'buggy.rar';

$rar = RarArchive::open($local_path);
$entries = $rar->getEntries();

$entry	= $rar->getEntry('08-twisted_sister-deck_the_halls.mp3');
$declared_size	=	$entry->getUnpackedSize();
$declared_crc	=	$entry->getCrc();
$declared_name	=	$entry->getName();

echo "Expected:\t Size:{$declared_size}\tHash:{$declared_crc}\n";

// Extract item to disk
$extracted_path	= sys_get_temp_dir().DIRECTORY_SEPARATOR.'extracted';
$entry->extract(false, $extracted_path);
$extracted_size	= filesize($extracted_path);
$extracted_hash	= hash_file('crc32b',$extracted_path);
echo "Extracted:\t Size:{$extracted_size}\tHash:{$extracted_hash}\n";

// "Stream" file
$stream		=	$entry->getStream();
$stream_path	=	sys_get_temp_dir().DIRECTORY_SEPARATOR.'stream';
$stream_fp	=	fopen($stream_path,'w');
$stram_size	=	filesize($stream_path);
$stram_hash	=	hash_file('crc32b',$stream_path);
echo "Stream:\t\t Size:{$stram_size}\tHash:{$stram_hash}\n";

echo "\nVery strange number {$stram_size} = ",$stram_size/1024/1024,'MB which clearly indicates a bug',PHP_EOL;
echo "PHP \t",phpversion(),PHP_EOL;
echo "OS \t",php_uname(),PHP_EOL;


Expected result:
Expected:        Size:5069304   Hash:a7bab6b3
Extracted:       Size:5069304   Hash:a7bab6b3
Stream:          Size:5069304   Hash:a7bab6b3

Actual result:
Expected:        Size:5069304   Hash:a7bab6b3
Extracted:       Size:5069304   Hash:a7bab6b3
Stream:          Size:4194304   Hash:51ccf6cb


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-03 10:36 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: tony2001
 [2016-04-21 15:21 UTC] vangog at gmail dot com
Google drive changed link, so be so kind to download it manually
 [2016-04-22 08:18 UTC]
-Assigned To: tony2001 +Assigned To: cataphract
 [2016-04-22 08:18 UTC]
Gustavo, can you take a look at it?
 [2017-07-17 14:21 UTC]
-Status: Assigned +Status: Feedback
 [2017-07-17 14:21 UTC]
I couldn't reproduce this with files I created myself and the link you sent no longer works. Can you upload it again, please?
 [2017-07-30 04:22 UTC] pecl-dev 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: Tue Jul 23 20:01:31 2024 UTC