|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-05-04 11:02 UTC] cweiske@php.net
-Status: Open
+Status: Duplicate
[2017-05-04 11:02 UTC] cweiske@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 14:00:01 2025 UTC |
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