Bug #51952 [NEW]: __FILE__ and dirname() are returning wrong pathes when working with junctions

From: Date: Sun, 30 May 2010 23:39:53 +0000
Subject: Bug #51952 [NEW]: __FILE__ and dirname() are returning wrong pathes when working with junctions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150947@lists.php.net to get a copy of this message
From:             
Operating system: Windows Vista/7
PHP version:      5.2.13
Package:          Directory function related
Bug Type:         Bug
Bug description:__FILE__ and dirname() are returning wrong pathes when working with junctions

Description:
------------
Consister the following setup:

You keep your source code in "C:\Repositories\example.org\trunk".
You just point your DOCUMENT_ROOT to that folder via symlink/junction:

httpd.conf:
[...]
DOCUMENT_ROOT "C:\Sites\example.org\htdocs"
[...]

C:\Sites\example.org>dir
 Volume in drive D is System
 Volume Serial Number is E49D-A2E7

 Directory of C:\Sites\example.org

2010-05-31  01:08    <DIR>          .
2010-05-31  01:08    <DIR>          ..
2010-05-31  01:08    <JUNCTION>     htdocs
[C:\Repositories\example.org\trunk]

You now run the script "C:\Sites\example.org\htdocs\test.php".

Test script:
---------------
<?php
echo 'File: ' . __FILE__ . PHP_EOL;
echo 'Dir: ' . dirname(__FILE__) . PHP_EOL;

Expected result:
----------------
File: C:\Repositories\example.org\trunk\test.php
Dir: C:\Repositories\example.org\trunk

Actual result:
--------------
File: C:\Sites\example.org\htdocs\test.php
Dir: C:\Sites\example.org\htdocs

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51952&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51952&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51952&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=51952&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51952&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51952&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51952&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51952&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51952&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51952&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51952&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51952&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51952&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51952&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51952&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51952&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51952&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51952&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51952&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51952&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51952&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51952&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#150947) next »