Edit report at https://bugs.php.net/bug.php?id=52013&edit=1
ID: 52013 Updated by: mbecc...@php.net Reported by: frederic dot hardy at mageekbox dot net Summary: Unable to decompress files in a compressed phar. Status: Closed Type: Bug Package: PHAR related Operating System: FreeBSD PHP Version: 5.3.2 Assigned To: bjori Block user comment: N Private report: N New Comment: Issue doesn't seem to be fixed on my FreeBSD 6.2 box even using latest 5.4 HEAD. The phar_stream_copy_to_stream() call returns failure due to an error in the underlying write(). Errno is 14 (Bad address) and my feeling is that the write len ends up being actually bigger than the source buffer. Previous Comments: ------------------------------------------------------------------------ [2011-08-29 14:20:28] bj...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2011-08-29 14:19:44] bj...@php.net Automatic comment from SVN on behalf of bjori Revision: http://svn.php.net/viewvc/?view=revision&revision=315703 Log: Fixed bug#52013 (Unable to decompress files in a compressed phar) ------------------------------------------------------------------------ [2010-07-02 04:46:45] ericstew...@php.net Automatic comment from SVN on behalf of ericstewart Revision: http://svn.php.net/viewvc/?view=revision&revision=300928 Log: Added test for bug 52013 to PHP_5_3. ------------------------------------------------------------------------ [2010-07-02 04:45:58] ericstew...@php.net Automatic comment from SVN on behalf of ericstewart Revision: http://svn.php.net/viewvc/?view=revision&revision=300927 Log: Added test for bug 52013 to trunk. ------------------------------------------------------------------------ [2010-06-07 11:55:42] frederic dot hardy at mageekbox dot net Description: ------------ Use Phar::decompressFiles() to decompress files in a phar where files was compressed with Phar::compressFiles(Phar::GZ) throw an exception. Configure Command => './configure' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-libxml' '--with-libxml-dir=/usr/local' '--with-pcre-regex=/usr/local' '--program-prefix=' '--disable-cgi' '--with-apxs2=/usr/local/sbin/apxs' '--with-regex=php' '--with-zend-vm=CALL' '--disable-ipv6' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=i386-portbld-freebsd8.0' Phar API version : 1.1.1 df -h output : /dev/ad0s1e 66G 7.6G 53G 13% /usr Test script: --------------- <?php mkdir(__DIR__ . '/files'); for ($file = 1; $file < 50; $file++) { file_put_contents(__DIR__ . '/files/' . $file . '.php', '<?php echo \'' . str_repeat($file, 5000) . '\'; ?>'); } $phar = new \Phar(__DIR__ . '/compressed.phar'); $phar->buildFromDirectory(__DIR__ . '/files', '/\.php$/'); $phar->setSignatureAlgorithm(\Phar::SHA1); $phar->compressFiles(\Phar::GZ); for ($file = 1; $file < 50; $file++) { unlink(__DIR__ . '/files/' . $file . '.php'); } rmdir(__DIR__ . '/files'); $phar = new \Phar(__DIR__ . '/compressed.phar'); $phar->decompressFiles(); foreach ($phar as $file) { var_dump(file_get_contents($file->getFilename())); } ?> Expected result: ---------------- No output and phar was decompressed. Actual result: -------------- fch@witchblade:~/tmp/phar 362> php -d phar.readonly=0 generator.php PHP Fatal error: Uncaught exception 'BadMethodCallException' with message 'unable to write contents of file "1.php" to new phar "/usr/home/fch/tmp/phar/compressed.phar"' in /usr/home/fch/tmp/phar/generator.php:25 Stack trace: #0 /usr/home/fch/tmp/phar/generator.php(25): Phar->decompressFiles() #1 {main} thrown in /usr/home/fch/tmp/phar/generator.php on line 25 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=52013&edit=1