Bug #72738 [NEW]: realpath() expands junction points

From: Date: Tue, 02 Aug 2016 19:31:34 +0000
Subject: Bug #72738 [NEW]: realpath() expands junction points
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202843@lists.php.net to get a copy of this message
From:             anrdaemon at freemail dot ru
Operating system: Windows
PHP version:      7.1.0beta1
Package:          Filesystem function related
Bug Type:         Bug
Bug description:realpath() expands junction points

Description:
------------
On Windows, realpath() expands the directory junction points.
According to an apparently authoritative assesment of pajoye@php.net in
the https://bugs.php.net/bug.php?id=72642 , this
shouldn't happen.

Test script:
---------------
<?php

$rootdir = substr(getenv('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";
$rfile1 = realpath($file);
$rfile2 = realpath($rfile1);
printf("orig.file name: %s\n", $file);
printf("realpath(name): %s (%s)\n", $rfile1, $file == $rfile1 ? 'Ok' :
'fail');
printf("THE real name:  %s (%s)\n", $rfile2, $file == $rfile2 ? 'Ok' :
'fail');

rmdir("{$rootdir}home");
rmdir("{$tmpdir}\\test.dir");


Expected result:
----------------
According to pajoye@php.net, expansion shouldn't happen, and all paths
must be the same == the original path.

Actual result:
--------------
All paths are different. On each iteration, realpath() only expands a
portion of nested junctions.

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



Thread (3 messages)

« previous php.bugs (#202843) next »