Bug #67071 [Opn->Dup]: webPhar() does not work with symlinked files
Edit report at https://bugs.php.net/bug.php?id=67071&edit=1
ID: 67071
Updated by: cweiske@php.net
Reported by: cweiske@php.net
Summary: webPhar() does not work with symlinked files
-Status: Open
+Status: Duplicate
Type: Bug
Package: PHAR related
Operating System: Linux
PHP Version: 5.4.27
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #52322 - it has the same cause.
Previous Comments:
------------------------------------------------------------------------
[2014-04-14 04:09:29] cweiske@php.net
Related To: Bug #52322
------------------------------------------------------------------------
[2014-04-14 04:07:35] cweiske@php.net
Description:
------------
Running a symlinked .phar file through a web server makes Phar::webPhar() return, thus not detecting
that it's running in a web environment.
The use case for symlinked phars is version updated. Suppose my .phar-released app has several
version "test-0.0.1.phar" and "test-0.0.2.phar", but I don't want to expose
that in the browser URL. So I simply symlink test.phar to test-0.0.1.phar, and updating simply means
changing the symlink to point to test-0.0.2.phar.
Steps to reproduce:
1. Create the phar with the given test script
2. Open phar in browser, you'll get "web".
3. Symlink it to test2.phar
4. Open test2.phar in browser, you'll get "cli".
Test script:
---------------
<?php
if (file_exists('test.phar')) {
unlink('test.phar');
}
$phar = new Phar('test.phar');
$phar->addFromString('www/index.php', '<?php echo "web";?>');
$phar->setStub(
'<?php Phar::webPhar(null, "www/index.php"); echo "cli\n";
__HALT_COMPILER(); ?>'
);
?>
Expected result:
----------------
"web" from test2.phar
Actual result:
--------------
"cli" from test2.phar
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67071&edit=1
Thread (2 messages)