Edit report at https://bugs.php.net/bug.php?id=62322&edit=1
ID: 62322 Updated by: ahar...@php.net Reported by: daniele dot segato at gmail dot com Summary: __FILE__ resolves symlinks? -Status: Open +Status: Duplicate Type: Bug -Package: Directory function related +Package: Scripting Engine problem Operating System: Unix/Linux PHP Version: 5.4.4RC2 Block user comment: N Private report: N New Comment: Duplicate of request #42516. Previous Comments: ------------------------------------------------------------------------ [2012-06-14 13:09:42] daniele dot segato at gmail dot com Description: ------------ As outlined in bug 38790 ( https://bugs.php.net/bug.php?id=38790 ) php do not keep the "context" information about the path. The author of that comment being closed as "not a bug" was not very polite but he was right about the report. suppose a request to: http://<somehost>/some/path/file.php is performed the web server know that is mapping to (for example) to /var/www/some/path/file.php and should give that to php engine. if, accidentally, "path" is a symbolic link then php should consider context. In unix if you are in /var/www/some/path and you do cd .. you are sent back to /var/www/some even if "path" is a symbolic link that happen because the shell consider the context. if php does not do that you can't use symlink reliably. Consider that a feature request if you don't like "bug" :) Even having an additional define like: __PSEUDO_DIR_PATH__ that doesn't solve symlink may be enough to give the feature to an user but I think both __DIR__ and __FILE__ should NOT resolve symlinks you can always use realpath() if you need to, but I understand that this can introduce all sort of backward compatibility issue Please re-consider your "not-a-bug" decision. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62322&edit=1