From:             
Operating system: FreeBSD
PHP version:      5.3.2
Package:          PHAR related
Bug Type:         Bug
Bug description:Unable to decompress files in a compressed phar.

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 bug report at http://bugs.php.net/bug.php?id=52013&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52013&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52013&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52013&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52013&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52013&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52013&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52013&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52013&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52013&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52013&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52013&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52013&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52013&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52013&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52013&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52013&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52013&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52013&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52013&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52013&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52013&r=mysqlcfg

Reply via email to