Edit report at http://bugs.php.net/bug.php?id=51952&edit=1
ID: 51952
Comment by: whistl0r+phpbug at googlemail dot com
Reported by: whistl0r+phpbug at googlemail dot com
Summary: __FILE__ and dirname() are returning wrong pathes when
working with junctions
Status: Open
Type: Bug
Package: Directory function related
Operating System: Windows Vista/7
PHP Version: 5.2.13
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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