php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: daniele dot segato at gmail dot com
New email:
PHP Version: OS:

 

 [2012-06-14 13:09 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-15 00:46 UTC] aharvey@php.net
Duplicate of request #42516.
 [2012-06-15 00:46 UTC] aharvey@php.net
-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 Dec 21 13:01:31 2024 UTC