Req #46260 [Com]: __FILE__ should not resolve symlink paths
| From: | nars at clix dot pt | Date: | Tue, 25 Oct 2011 19:45:34 +0000 |
| Subject: | Req #46260 [Com]: __FILE__ should not resolve symlink paths | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164563@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46260&edit=1
ID: 46260
Comment by: nars at clix dot pt
Reported by: bugs dot php dot net at callum-macdonald dot com
Summary: __FILE__ should not resolve symlink paths
Status: Open
Type: Feature/Change Request
Package: Feature/Change Request
Operating System: Linux
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
+1
Previous Comments:
------------------------------------------------------------------------
[2011-07-26 16:54:10] tony at brown dot org
I'm another +1 for this, causing me some real headaches because for deployment I store multiple
versions of a site with the latest been symlinked to for apache.
There are modules in the application which are licensed and use the file path as part of it's
verification. When we deploy, the path is seen as changed and the modules get disabled. :-(
------------------------------------------------------------------------
[2011-04-27 04:38:48] gnoodl+php at gmail dot com
$_SERVER["SCRIPT_FILENAME"] cannot be used in place of __FILE__ as it does not
resolve the path of an included file.
Eg,
// file1.php
include 'file2.php';
// file2.php
echo $_SERVER['SCRIPT_FILENAME'];
Executing file1.php will result in "/path/to/file1.php"
------------------------------------------------------------------------
[2010-12-10 18:12:17] php at micropro dot cz
I think I have a resoulution ... use $_SERVER["SCRIPT_FILENAME"] instead of __file__. It
should work the same way, but is absolute path, not resolved. It works for me fine :-)
------------------------------------------------------------------------
[2010-11-10 16:52:41] jimmy at powerzone dot dk
I agree. Hosting multiple PHP systems based on the same installation is no easy task, when __FILE__
is used in conjunction with symlinks. Very frustrating. I vote for a new contant; __FILEPATH__ which
does not resolve symlinks.
------------------------------------------------------------------------
[2010-08-26 09:12:33] rix at mindginative dot com
+1 for this. I encountered this issue today and was hoping that there's a better
way not to resolve symlink in __FILE__. As suggested above, perhaps __FILE_LINK__
that either return the symlink path or false if none.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=46260
--
Edit this bug report at https://bugs.php.net/bug.php?id=46260&edit=1