Bug #73884 [Com]: is_dir() returns false for junction / symlinkd

From: Date: Sat, 07 Jan 2017 19:37:39 +0000
Subject: Bug #73884 [Com]: is_dir() returns false for junction / symlinkd
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206359@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73884&edit=1 ID: 73884 Comment by: kulakov74 at yandex dot ru Reported by: kulakov74 at yandex dot ru Summary: is_dir() returns false for junction / symlinkd Status: Open Type: Bug Package: Filesystem function related Operating System: Windows 8.1 PHP Version: 7.1.0 Block user comment: N Private report: N New Comment: For tests, I tried "Default User", it was owned by System and had a right to read/execute for everyone. After I took over ownership and removed the right, I could not "enter" it and Dir stopped displaying its target (just showed "[..]"). is_dir() still returned false, which is actully not correct because if it has no way to know and check the target, it can't know if it's a dir or not, no error message displayed either. I readded the right to read/execute for everyone and everything works as it did before. The junction I created myself (templink) has "read & execute" right for "Users", not for everyone. Also it has Modify permission for Authenticated users. I added both to "Default User" but it didn't help. "Default User" also had "hs" attributes (hidden and system), but after I cleared them nothing changed. The only difference left is that "Default User" has the permissions added to it directly while templink inherits them from C:\. I disabled inheritance for templink but is_dir() still worked for it. Still, I could make is_dir() return false for templink by removing all rights. So, this could be related with permissions, but I couldn't prove it, and even if I did, php does smth wrong cause it shouldn't cause problems. Previous Comments: ------------------------------------------------------------------------ [2017-01-06 21:41:54] ab@php.net Thanks for the report. Might be good a permission issue, yep. Would you mind to investigate more on it, maybe checking what difference the extended permissions tell, etc.? Thanks. ------------------------------------------------------------------------ [2017-01-06 20:12:44] kulakov74 at yandex dot ru Description: ------------ On my Windows PC, I scanned the whole directory structure in C:\ (both from browsers and in CLI mode) and found out that for all of the junctions / symlinks that had been created by the system is_dir() returns false. According to the manual, "If filename is a symbolic or hard link then the link will be resolved and checked." but this is only the case with the junctions / symlinks I created manually for testing. It might seem the problem is with permissions but I run the script as admin and also I can see the fact that the items in question are junctions by using plain console (cmd.exe) even not as admin, for ex.: c:\Users>dir /a:l ... 22.08.2013 17:45 <SYMLINKD> All Users [C:\ProgramData] 22.08.2013 17:45 <JUNCTION> Default User [C:\Users\Default] ... BTW, In Windows, junctions and symlinks are almost the same. Test script: --------------- $Dir="C:\Users\All Users"; if (is_dir($Dir)) echo("dir"); else echo("not a dir"); Expected result: ---------------- dir Actual result: -------------- not a dir ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73884&edit=1

« previous php.bugs (#206359) next »