ID: 46260 Comment by: bugs dot php dot net at callum-macdonald dot com Reported By: bugs dot php dot net at callum-macdonald dot com Status: Open Bug Type: Feature/Change Request Operating System: Linux PHP Version: 5.2.6 New Comment:
$_SERVER['PHP_SELF'] only relates to the main script, not the currently included file. It's useful, but a completely separate issue. There is, as far as I can see, no way to get the non symlink resolved path of the currently included file. Previous Comments: ------------------------------------------------------------------------ [2009-01-31 22:54:44] luke_phpbugs at dashjr dot org $_SERVER["PHP_SELF"] helps a little. ------------------------------------------------------------------------ [2008-10-09 01:32:07] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46260&edit=1