Bug #62322 [NEW]: __FILE__ resolves symlinks?
From: daniele dot segato at gmail dot com
Operating system: Unix/Linux
PHP version: 5.4.4RC2
Package: Directory function related
Bug Type: Bug
Bug description:__FILE__ resolves symlinks?
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 bug report at https://bugs.php.net/bug.php?id=62322&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62322&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62322&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62322&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62322&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62322&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62322&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62322&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62322&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62322&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62322&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62322&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62322&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62322&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62322&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62322&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62322&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62322&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62322&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62322&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62322&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62322&r=mysqlcfg
Thread (2 messages)
- daniele dot segato at gmail dot com