Edit report at http://bugs.php.net/bug.php?id=53801&edit=1
ID: 53801
User updated by: panman at traileyes dot com
Reported by: panman at traileyes dot com
Summary: Cannot Access Phar::mount()'ed Items From Web
Status: Open
Type: Bug
Package: PHAR related
Operating System: Win 7 32 bit
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
I was thinking about this some more and came up with a possible reason
why this doesn't work, along with bug 53809. The Phar's manifest is
registered when Phar::mapPhar() or Phar::webPhar() is called. Well,
since the files that are Phar::mount()'ed come after one of the
"loading" methods then those files are not included in the manifest.
I tried to fix this by moving the Phar::mount()'s before the
Phar::webPhar() but that didn't work. I'm thinking that's because
Phar::mount() won't work until it can look at a loaded manifest.
I also tried calling Phar::mapPhar() after the Phar::mount()'s but that
didn't do anything. Not sure if it doesn't re-load the manifest after
it's been loaded once...
Anyway, it would be nice if Phar::mount() would register itself with the
manifest automatically or have Phar::mapPhar() re-load the manifest,
including the Phar::mount()'ed files.
Previous Comments:
------------------------------------------------------------------------
[2011-01-22 04:41:31] panman at traileyes dot com
Added the OS I'm on.
------------------------------------------------------------------------
[2011-01-21 05:24:07] panman at traileyes dot com
Description:
------------
Using the mount() method brings in files/folders so that PHP scripts can
use them internally. However, those files are not accessible through the
Web server as the built-in files are. The directory structure should be
as follows for the test below:
make.php = The test script below
internal.html = <p>From the inside</p>
external.html = <p>From the outside</p>
include.php = <?php include 'external.html'; ?>
test.phar = Will be built from the test script
Test script:
---------------
<?php
try {
$p = new Phar('test.phar');
$p->addFile('internal.html');
$p->addFile('include.php');
$p->setStub('<?php
Phar::webPhar("test.phar", "internal.html");
Phar::mount(__DIR__ . "/external.html", "external.html");
__HALT_COMPILER();');
echo 'Done making test.phar';
} catch (Exception $e) {
echo 'Exception caught: ' . $e->getMessage();
}
?>
Expected result:
----------------
Visiting: make.php
Done making test.phar
Visiting: test.phar/internal.html
>From the inside
Visiting: test.phar/external.html
>From the outside
Visiting: test.phar/include.php
>From the outside
Actual result:
--------------
Visiting: make.php
Done making test.phar
Visiting: test.phar/internal.html
>From the inside
Visiting: test.phar/external.html
404 - File /external.html Not Found
Visiting: test.phar/include.php
>From the outside
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53801&edit=1