Bug #67071 [NEW]: webPhar() does not work with symlinked files
| From: | cweiske@php.net | Date: | Mon, 14 Apr 2014 04:07:36 +0000 |
| Subject: | Bug #67071 [NEW]: webPhar() does not work with symlinked files | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-185234@lists.php.net to get a copy of this message | ||
From: cweiske
Operating system: Linux
PHP version: 5.4.27
Package: PHAR related
Bug Type: Bug
Bug description:webPhar() does not work with symlinked files
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 bug report at https://bugs.php.net/bug.php?id=67071&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67071&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67071&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67071&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67071&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67071&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67071&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67071&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67071&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67071&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67071&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67071&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67071&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67071&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67071&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67071&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67071&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67071&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67071&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67071&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67071&r=mysqlcfg