Bug #51952 [Opn->Bgs]: __FILE__ and dirname() are returning wrong pathes when working with junctions
| From: | pajoye@php.net | Date: | Mon, 31 May 2010 00:36:59 +0000 |
| Subject: | Bug #51952 [Opn->Bgs]: __FILE__ and dirname() are returning wrong pathes when working with junctions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-150950@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51952&edit=1
ID: 51952
Updated by: pajoye@php.net
Reported by: whistl0r+phpbug at googlemail dot com
Summary: __FILE__ and dirname() are returning wrong pathes when
working with junctions
-Status: Open
+Status: Bogus
Type: Bug
Package: Directory function related
Operating System: Windows Vista/7
PHP Version: 5.2.13
New Comment:
Windows was the only platform where it did not resolve it. The reason
was that 5.2 did not support symlink on windows (or junctions)
resolutions.
Previous Comments:
------------------------------------------------------------------------
[2010-05-31 01:44:18] whistl0r+phpbug at googlemail dot com
I found this inconsistent behavior, after upgrading to PHP 5.3, because
a required
once call (required_once realpath(dirname(__FILE__) .
'/../configs/main.php');)
failed.
It failed because PHP 5.3 resolves the symlinks.
I checked the documentation and it says that this is the wanted
behavior.
So it seems like, because it nothing new in PHP 5.3, that it must be a
bug in PHP
5.2.
------------------------------------------------------------------------
[2010-05-31 01:39:52] whistl0r+phpbug at googlemail dot com
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 this bug report at http://bugs.php.net/bug.php?id=51952&edit=1