From:
Operating system: Win 7 32 bit
PHP version: 5.3.5
Package: PHAR related
Bug Type: Bug
Bug description:Phar::mount()'ed Files Don't Show Up In Dir Listings
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
--
Edit bug report at http://bugs.php.net/bug.php?id=53809&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53809&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53809&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53809&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53809&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53809&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53809&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53809&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53809&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53809&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53809&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53809&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53809&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53809&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53809&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53809&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53809&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53809&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53809&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53809&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53809&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53809&r=mysqlcfg