From:
Operating system: MacOS 10.6.6
PHP version: 5.3.5
Package: PHAR related
Bug Type: Bug
Bug description:Phar::extractTo() does not accept specific directories to be
extracted
Description:
------------
Phar::extractTo() does not allow specific directories to be extracted. The
documentation states the second parameter can be a file or directory to
only
extract the file or directory from the phar archive.
Specific files can be extracted however an exception is thrown when a
directory is
passed.
Test script:
---------------
<?php
$phar = new Phar('/tmp/test.phar');
$phar->buildFromDirectory('/path/to/source');
unset($phar);
$phar = new Phar('/tmp/test.phar');
$phar->extractTo('/tmp/test/', 'subdir1/subdir2/', true); // throws
exception
// $phar->extractTo('/tmp/test/', 'subdir1/subdir2/file.txt', true); //
works as intended
?>
Expected result:
----------------
The specific directory should be extracted from the phar archive.
Actual result:
--------------
Fatal error: Uncaught exception 'PharException' with message 'Phar Error:
attempted to extract non-existent file "subdir1/subdir2/" from phar
"/tmp/test.phar"' in /phar-test.php on line 7
--
Edit bug report at http://bugs.php.net/bug.php?id=54289&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54289&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54289&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54289&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54289&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54289&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54289&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54289&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54289&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54289&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54289&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54289&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54289&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54289&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54289&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54289&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54289&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54289&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54289&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54289&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54289&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54289&r=mysqlcfg