|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 08:00:02 2025 UTC |
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>