php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67161 ZipArchive::getStream() returns NULL for certain file
Submitted: 2014-04-30 19:30 UTC Modified: 2015-05-12 12:37 UTC
From: bugs dot php dot net at tjbp dot net Assigned: jpauli
Status: Closed Package: Zip Related
PHP Version: 5.5.11 OS: Arch Linux x64
Private report: No CVE-ID:
 [2014-04-30 19:30 UTC] bugs dot php dot net at tjbp dot net
Description:
------------
According to the documentation, ZipArchive::getStream() will return the contents of a file, or false on failure. I'm receiving NULL for a certain file in an archive, though the archive passes validation with unzip -t.

The archive in question:
http://upload.tjbp.net/zipbug.zip

Test script:
---------------
$za = new \ZipArchive;

$za->open('zipbug.zip');

var_dump($za->getStream('gta_sa.set'));

Expected result:
----------------
Contents of the file in the archive

Actual result:
--------------
NULL

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-12 16:09 UTC] cmbecker69 at gmx dot de
I assume the file can't be read, because it is compressed with
Deflate64 (byte 0x140 of zipbug.zip is 0x09), and this compression
method is likely to be unsupported.

The NULL return value is the result of zip_stat() succeeding, but
php_stream_zip_open() failing in ZipArchive::getStream()[1]. A
simple

  else {
      RETURN_FALSE;
  }
  
at the end of the method would return FALSE, but the return value
of NULL may well be by design, and if so the documentation should
be improved.

[1] <http://lxr.php.net/xref/PHP_5_5/ext/zip/php_zip.c#2582>
 [2015-04-16 12:54 UTC] cmb@php.net
-Package: zip +Package: Zip Related
 [2015-05-01 20:23 UTC] cmb@php.net
-Status: Open +Status: Analyzed
 [2015-05-12 12:37 UTC] jpauli@php.net
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: jpauli
 [2015-05-12 12:37 UTC] jpauli@php.net
Please try using this snapshot:

  http://snaps.php.net/php-trunk-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Merged against master
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Apr 30 18:01:35 2017 UTC