php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58937 Streaming and unicode filenames support
Submitted: 2009-11-05 18:35 UTC Modified: 2009-11-19 13:48 UTC
From: glopes at nebm dot ist dot utl dot pt Assigned:
Status: Closed Package: rar (PECL)
PHP Version: 5.3.0 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: glopes at nebm dot ist dot utl dot pt
New email:
PHP Version: OS:

 

 [2009-11-05 18:35 UTC] glopes at nebm dot ist dot utl dot pt
Description:
------------
I've added support for streaming for RAR files. It requires a lot of memory. The unrar library requires an extraction window with 4MB to extract the file, and the extension uses a 4MB buffer (max, actually it uses a smaller buffer if the file being extracted is smaller than 4MB). It would be possible to use the window directly, but that would require more profound changes to the unrar library than I was willing to make.

Unfortunately, *some* changes to the RARLAB's unrar library were necessary. The method the unrar library supports would be to set a callback function for when data was read, pass RAR_TEST instead of RAR_EXTRACT to ProcessFile, do the extraction in another thread and, fill the buffer and then wait during each call to the callback function and notify the extraction thread once the buffer was empty. This would also require 4MB+4MB of memory for the window+buffer.

I also updated the bundled library to the latest version and added a method to the RarEntry class for getting the name of entry in Unicode/UTF-8.

I've included two patch files: one against http://pecl.php.net/get/rar-1.0.0.tgz and another one, for reference, of the bundled patched unrar lib against the latest version of the vanilla RARLAB's unrar lib available in http://www.rarlab.com/rar/unrarsrc-3.9.6.tar.gz .

I've tested the extension with multi-volume files using both the Store method and the "29" algorithm. I do not have files that use the older compression algorithms, so could not test the other two, but, in principle, they should also work. I've done all the tests in Windows with 32-bit builds, and merely confirmed that the extension compiled and could be loaded under Linux. I used version 5.3.0 of PHP.

Please review the patches and consider adding the implemented functionality to the RAR extension.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-05 18:39 UTC] glopes at nebm dot ist dot utl dot pt
I uploaded the patches here:

http://nebm.ist.utl.pt/~glopes/patch_php_rar.diff
http://nebm.ist.utl.pt/~glopes/patch_unrarlib.diff
 [2009-11-16 03:19 UTC] glopes at nebm dot ist dot utl dot pt
I also uploaded a VC9 ZTS Windows build here:
http://nebm.ist.utl.pt/~glopes/php_rar.dll
Symbols are also available:
http://nebm.ist.utl.pt/~glopes/php_rar.pdb
 [2009-11-19 13:48 UTC] glopes at nebm dot ist dot utl dot pt
Patch incorporated as of revision #291023.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC