Bug #50659 [Opn->Fbk]: Junctions over a share fail

From: Date: Fri, 15 Oct 2021 11:30:34 +0000
Subject: Bug #50659 [Opn->Fbk]: Junctions over a share fail
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237207@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=50659&edit=1 ID: 50659 Updated by: cmb@php.net Reported by: RQuadling at GMail dot com Summary: Junctions over a share fail -Status: Open +Status: Feedback Type: Bug Package: Directory function related Operating System: win32 only - Windows XP SP3 PHP Version: 5.3SVN-2010-01-04 (snap) -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > Essentially absolute paths are realpath()-able just fine, but > relative paths are not. This appears to have been resolved in the meantime, or do you still experience this with any of the actively supported PHP versions[1]? BTW, the following part of the reproducer doesn't look right: MD J:\RAQ_Junc JUNCTION J:\RAQ_Junc C:\RAQ_Orig I don't think it's possible to convert an existing folder to a junction; I went without the MD. [1] <https://www.php.net/supported-versions.php> Previous Comments: ------------------------------------------------------------------------ [2010-01-04 17:55:48] RQuadling at GMail dot com Description: ------------ realpath() returns false for files inside junctions inside a share accessed using a relative path. Ok. I _did_ say this was an edge case. The code below is an batch script utilising Windows NET SHARE and NET MAP commands to create a drive J: mapped to C:\RAQ_Share and the JUNCTION program from System Internals to create a junction in that share. The last few lines relate specifically to PHP. Essentially absolute paths are realpath()-able just fine, but relative paths are not. Reproduce code: --------------- @ECHO OFF ECHO Create Original directory and file. MD C:\RAQ_Orig ECHO This is the file. > C:\RAQ_Orig\File.txt ECHO. ECHO Create share MD C:\RAQ_Share NET SHARE RAQ_Shared=C:\RAQ_Share /UNLIMITED ECHO. ECHO Map share @NET USE J: /D > NUL NET USE J: \\%COMPUTERNAME%\RAQ_Shared ECHO. ECHO Create junction MD J:\RAQ_Junc JUNCTION J:\RAQ_Junc C:\RAQ_Orig ECHO. ECHO Show the folders. DIR \RAQ* ECHO. ECHO See contents of junction DIR J:\RAQ_Junc\File.txt ECHO. ECHO Use PHP to report realpaths PHP -v PHP -n -r "var_dump(realpath('J:/RAQ_Junc/File.txt'));" CD /D J:\ PHP -n -r "var_dump(realpath('/RAQ_Junc/File.txt'));" CD \RAQ_Junc PHP -n -r "var_dump(realpath('./File.txt'));" Expected result: ---------------- Create Original directory and file. Create share RAQ_Shared was shared successfully. Drop and map share J: was deleted successfully. The command completed successfully. Create junction Junction v1.05 - Windows junction creator and reparse point viewer Copyright (C) 2000-2007 Mark Russinovich Systems Internals - http://www.sysinternals.com Created: J:\RAQ_Junc Targetted at: C:\RAQ_Orig Show the folders. Volume in drive C has no label. Volume Serial Number is 1044-5992 Directory of C:\ 2010/01/04 17:47 <DIR> RAQ_Orig 2010/01/04 17:47 <DIR> RAQ_Share 0 File(s) 0 bytes 2 Dir(s) 11,663,155,200 bytes free See contents of junction Volume in drive J has no label. Volume Serial Number is 1044-5992 Directory of J:\RAQ_Junc 2010/01/04 17:47 20 File.txt 1 File(s) 20 bytes 0 Dir(s) 11,663,155,200 bytes free Use PHP to report realpaths PHP 5.3.3-dev (cli) (built: Jan 4 2010 12:59:42) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies string(20) "C:\RAQ_Orig\File.txt" string(20) "C:\RAQ_Orig\File.txt" string(20) "C:\RAQ_Orig\File.txt" Actual result: -------------- Create Original directory and file. Create share RAQ_Shared was shared successfully. Drop and map share J: was deleted successfully. The command completed successfully. Create junction Junction v1.05 - Windows junction creator and reparse point viewer Copyright (C) 2000-2007 Mark Russinovich Systems Internals - http://www.sysinternals.com Created: J:\RAQ_Junc Targetted at: C:\RAQ_Orig Show the folders. Volume in drive C has no label. Volume Serial Number is 1044-5992 Directory of C:\ 2010/01/04 17:47 <DIR> RAQ_Orig 2010/01/04 17:47 <DIR> RAQ_Share 0 File(s) 0 bytes 2 Dir(s) 11,663,155,200 bytes free See contents of junction Volume in drive J has no label. Volume Serial Number is 1044-5992 Directory of J:\RAQ_Junc 2010/01/04 17:47 20 File.txt 1 File(s) 20 bytes 0 Dir(s) 11,663,155,200 bytes free Use PHP to report realpaths PHP 5.3.3-dev (cli) (built: Jan 4 2010 12:59:42) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies string(20) "C:\RAQ_Orig\File.txt" string(20) "C:\RAQ_Orig\File.txt" bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=50659&edit=1

« previous php.bugs (#237207) next »