|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-01-22 08:52 UTC] panman at traileyes dot com
[2011-01-24 22:31 UTC] panman at traileyes dot com
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 09 07:00:01 2025 UTC |
Description: ------------ When using any sort of directory listings the Phar::mount()'ed files don't show up. Ex: readdir() scandir() SPL::DirectoryIterator() For the test below, the following folder structure should be setup: make.php = The test script below list.php = Also in the test script below page1.html = <p>Page 1</p> page2.html = <p>Page 2</p> page3.html = <p>Page 3</p> Test script: --------------- <?php // make.php try { $p = new Phar('test.phar'); $p->addFile('list.php'); $p->addFile('page1.html'); $p->addFile('page3.html'); $p->setStub('<?php Phar::interceptFileFuncs(); Phar::webPhar("test.phar", "list.php"); Phar::mount(__DIR__ . "/page2.html", "page2.html"); __HALT_COMPILER();'); echo 'Done making test.phar'; } catch (Exception $e) { echo 'Exception caught: ' . $e->getMessage(); } ?> <?php // list.php echo "<h3>readdir()</h3>\r\n"; $handle = opendir(Phar::running()); while (false !== ($file = readdir($handle))) { if ($file == "." || $file == "..") continue; echo "$file<br>\r\n"; } echo "<h3>scandir()</h3>\r\n"; foreach (scandir(Phar::running()) as $file) { if ($file == "." || $file == "..") continue; echo "$file<br>\r\n"; } echo "<h3>SPL::DirectoryIterator()</h3>\r\n"; foreach (new DirectoryIterator(Phar::running()) as $file) { if ($file->isDot()) continue; echo $file->getFilename() . "<br>\r\n"; } ?> Expected result: ---------------- Visiting: make.php Done making test.phar Visiting: test.phar/list.php readdir() ========= list.php page1.html page2.html page3.html scandir() ========= list.php page1.html page2.html page3.html SPL::DirectoryIterator() ======================== list.php page1.html page2.html page3.html Actual result: -------------- Visiting: make.php Done making test.phar Visiting test.phar/list.php readdir() ========= list.php page1.html page3.html scandir() ========= list.php page1.html page3.html SPL::DirectoryIterator() ======================== list.php page1.html page3.html