Edit report at http://bugs.php.net/bug.php?id=52013&edit=1

 ID:               52013
 Updated by:       fel...@php.net
 Reported by:      frederic dot hardy at mageekbox dot net
 Summary:          Unable to decompress files in a compressed phar.
-Status:           Open
+Status:           Assigned
 Type:             Bug
 Package:          PHAR related
 Operating System: FreeBSD
 PHP Version:      5.3.2
-Assigned To:      
+Assigned To:      cellog



Previous Comments:
------------------------------------------------------------------------
[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:
--------------
f...@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 http://bugs.php.net/bug.php?id=52013&edit=1

Reply via email to