Bug #72642 [Opn->Nab]: realpath() failing to expand path
| From: | pajoye@php.net | Date: | Fri, 22 Jul 2016 00:31:32 +0000 |
| Subject: | Bug #72642 [Opn->Nab]: realpath() failing to expand path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202495@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72642&edit=1
ID: 72642
Updated by: pajoye@php.net
Reported by: anrdaemon at freemail dot ru
Summary: realpath() failing to expand path
-Status: Open
+Status: Not a bug
Type: Bug
Package: Filesystem function related
Operating System: Windows
PHP Version: 7.1.0beta1
Block user comment: N
Private report: N
New Comment:
Junctions are like hard link and are not resolved by realpath (or readlink).
Previous Comments:
------------------------------------------------------------------------
[2016-07-21 23:38:53] anrdaemon at freemail dot ru
Description:
------------
realpath(), according to the documentation, is supposed to unwind every symlink and relative
reference in the given string and produce an absolute and unambiguous path.
Well⦠it doesn't perform its job quite as desired.
Affected PHP versions: same behavior observed in 5.3.29, 5.6.23, 7.0.8 and 7.1.0b1.
Test script:
---------------
<?php
$rootdir = substr($_SERVER['SystemRoot'], 0, 3);
$tmpdir = getenv('TEMP');
shell_exec("mklink /J \"{$rootdir}home\" \"{$rootdir}Users\"");
shell_exec("mklink /J \"{$tmpdir}\\test.dir\"
\"{$rootdir}home\\Public\\Desktop\"");
$file = "{$tmpdir}\\test.dir\\desktop.ini";
$rfile = realpath($file);
printf("orig.file name: %s\n", $file);
printf("realpath(name): %s\n", $rfile);
printf("THE real name: %s\n", realpath($rfile));
if($rfile != realpath($rfile))
print "Fail as is.\n";
rmdir("{$rootdir}home");
rmdir("{$tmpdir}\\test.dir");
Expected result:
----------------
orig.file name: C:\Users\ANRDAE~1\AppData\Local\Temp\test.dir\desktop.ini
realpath(name): C:\Users\Public\Desktop\desktop.ini
THE real name: C:\Users\Public\Desktop\desktop.ini
Actual result:
--------------
orig.file name: C:\Users\ANRDAE~1\AppData\Local\Temp\test.dir\desktop.ini
realpath(name): C:\home\Public\Desktop\desktop.ini
THE real name: C:\Users\Public\Desktop\desktop.ini
Fail as is.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72642&edit=1