|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62322 __FILE__ resolves symlinks?
Submitted: 2012-06-14 13:09 UTC Modified: 2012-06-15 00:46 UTC
From: daniele dot segato at gmail dot com Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: 5.4.4RC2 OS: Unix/Linux
Private report: No CVE-ID: None
 [2012-06-14 13:09 UTC] daniele dot segato at gmail dot com
As outlined in bug 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:

is performed

the web server know that is mapping to (for example) to

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

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-15 00:46 UTC]
Duplicate of request #42516.
 [2012-06-15 00:46 UTC]
-Status: Open +Status: Duplicate -Package: Directory function related +Package: Scripting Engine problem
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 08:01:29 2024 UTC