|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
|
Thank you for your help!
If the status of the bug report you submitted changes, you will be notified.
You may return here and check the status or update your report at any time. The URL for your bug report is: https://bugs.php.net/bug.php?id=46260.
[2008-10-09 01:32 UTC] bugs dot php dot net at callum-macdonald dot com
Description: ------------ See these bugs: http://bugs.php.net/bug.php?id=38790 http://bugs.php.net/bug.php?id=42516 http://bugs.php.net/bug.php?id=37603 The __FILE__ constant should not, in my opinion, resolve symbolic links on *nix operating systems. At the very least, there should be an option to control this behaviour. Because __FILE__ returns only the symlink resolved path, there is no way to get the symlink path of the currently included file. If __FILE__ returned the symlinkpath, the resolved path could be retrieved with realpath(__FILE__). The opposite is not true. There is no way to go from the resolved path to the original link path. I realise this is a feature not a bug, but I believe it is a serious shortcoming and limits the ability of PHP in symlinked situations. Reproduce code: --------------- See http://bugs.php.net/bug.php?id=37603 Expected result: ---------------- __FILE__ should return the symlink path Actual result: -------------- __FILE__ returns the resolved path PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Jul 14 13:00:01 2026 UTC |
If you're on an enviroment with bash available, you can use this snippet to get __FILE__ without resolving symlinks. It's a small hack, but it should be pretty safe. <?php $output = array(); exec('pwd', &$output); define('__LINK__', $output[0].substr(__FILE__, strpos(__FILE__, DIRECTORY_SEPARATOR))); ?>