|  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
 [2009-11-05 18:35 UTC] glopes at nebm dot ist dot utl dot pt
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 and another one, for reference, of the bundled patched unrar lib against the latest version of the vanilla RARLAB's unrar lib available in .

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-05 18:39 UTC] glopes at nebm dot ist dot utl dot pt
I uploaded the patches here:
 [2009-11-16 03:19 UTC] glopes at nebm dot ist dot utl dot pt
I also uploaded a VC9 ZTS Windows build here:
Symbols are also available:
 [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: Sun Feb 25 23:01:33 2024 UTC