|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-05-29 13:35 UTC] greg at chiaraquartet dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 21:00:01 2025 UTC |
Description: ------------ Sounds like a tabloid leader, but... Basically you can't work with entry file contents from a third-party zip archive at present, at all. Not only can you not var_dump(file_get_contents()), it's also not possible to convert a third-party zip archive to executable for the same reason - 'internal corruption' is reported in both cases. It seems that entry contents aren't being copied across in phar_open_entry_fp() when it comes to zip archives. Reproduce code: --------------- <?php /* adapted version of tests/zip/unixzip.phpt */ $a = new PharData(dirname(__FILE__) . '/files/zip.zip'); foreach ($a as $b) { if ($b->isDir()) { echo "dir " . $b->getPathName() . "\n"; } else { echo $b->getPathName() . "\n"; echo file_get_contents($b) . "\n"; } } if (isset($a['notempty/hi.txt'])) { echo $a['notempty/hi.txt']->getPathName() . "\n"; } ?> Expected result: ---------------- dir phar://%szip.zip%cempty phar://%szip.zip%chi.txt hi there dir phar://%szip.zip%cnotempty phar://%szip.zip/notempty/hi.txt Actual result: -------------- dir phar://C:/sandbox/php5/ext/phar/tests/zip/files/zip.zip\empty phar://C:/sandbox/php5/ext/phar/tests/zip/files/zip.zip\hi.txt Warning: file_get_contents(phar://C:/sandbox/php5/ext/phar/tests/zip/files/zip.zip\hi.txt): failed to open stream: phar error: internal corruption of phar "C:/sandbox/php5/ext/phar/tests/zip/files/zip.zip" (crc32 mismatch on file "hi.txt") in C:\sandbox\php5\ext\phar\tests\zip\unixzip.php on line 8 dir phar://C:/sandbox/php5/ext/phar/tests/zip/files/zip.zip\notempty phar://C:/sandbox/php5/ext/phar/tests/zip/files/zip.zip/notempty/hi.txt