From: Operating system: Win 7 32 bit PHP version: 5.3.5 Package: PHAR related Bug Type: Feature/Change Request Bug description:Phar::mount() Entire Directory
Description: ------------ It would be _very_ nice to be able to mount an external directory somewhere in the Phar. That way if there are many files that need to be included they don't need to each be Phar::mount()'ed. Note that all sub files and folders should also be in directory listings and available through the Web. Bugs 53809 and 53801. The directory structure should be as follows for the test below: make.php = In the test script below list.php = In the test script below ext/page1.html = <p>Page 1</p> ext/page2.html = <p>Page 2</p> Test script: --------------- <?php // make.php try { $p = new Phar('test.phar'); $p->addFile('list.php'); $p->setStub('<?php Phar::interceptFileFuncs(); Phar::webPhar("test.phar", "list.php"); Phar::mount(__DIR__ . "/ext/", "ext/"); __HALT_COMPILER();'); echo 'Done making test.phar'; } catch (Exception $e) { echo 'Exception caught: ' . $e->getMessage(); } ?> <?php // list.php $path = Phar::running() . '/ext'; echo "Path: $path<br>\r\n"; echo 'Exists: ' . (file_exists($path) ? 'Yes' : 'No') . "<br>\r\n"; echo "Listing...<br>\r\n"; foreach (new DirectoryIterator($path) as $file) { if ($file->isDot()) continue; echo $file->getFilename() . "<br>\r\n"; } echo "...done listing<br>\r\n"; ?> Expected result: ---------------- Visiting: make.php Done making test.phar Visiting: test.phar/list.php Path: phar://test.phar/ext Exists: Yes Listing... page1.html page2.html ...done listing Visiting: test.phar/ext/page1.html Page 1 Actual result: -------------- Visiting: make.php Done making test.phar Visiting: test.phar/list.php Path: phar://test.phar/ext Exists: No Listing... Visiting: test.phar/ext/page1.html 404 - File /ext/page1.html Not Found -- Edit bug report at http://bugs.php.net/bug.php?id=53810&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53810&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53810&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53810&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53810&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53810&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53810&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53810&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53810&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53810&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53810&r=support Expected behavior: http://bugs.php.net/fix.php?id=53810&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53810&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53810&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53810&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53810&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53810&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53810&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53810&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53810&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53810&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53810&r=mysqlcfg