Bug #73543 [Com]: Network drive file: is_readable() == false but file can be read

From: Date: Sat, 12 Feb 2022 02:27:45 +0000
Subject: Bug #73543 [Com]: Network drive file: is_readable() == false but file can be read
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239702@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73543&edit=1 ID: 73543 Comment by: master dot training365 at gmail dot com Reported by: hsh at autowise dot dk Summary: Network drive file: is_readable() == false but file can be read Status: Open Type: Bug Package: Filesystem function related Operating System: Windows 10 PHP Version: 7.0.13 Block user comment: N Private report: N New Comment: https://archive.org/details/glintpost-4dfcb2adc8d6 Previous Comments: ------------------------------------------------------------------------ [2021-10-07 13:06:06] cmb@php.net Related To: Bug #62199 ------------------------------------------------------------------------ [2021-07-29 16:33:27] cmb@php.net Related To: Bug #70467 ------------------------------------------------------------------------ [2019-06-14 08:37:54] sjon@php.net Related To: Bug #78159 ------------------------------------------------------------------------ [2016-11-22 15:40:34] hsh at autowise dot dk I'm putting my money on this being the same underlying bug as #68926, and the line from the bug report: >The issue here is that unmapped unix user accounts are mapped to built-in windows SIDs, which >are obviously have nothing to do with windows ACLs. ...is in effect in my setup as well and I think it's the core of the problem: I have not joined the AD, but provided my credentials only when connecting the drive. The code which compares access rights to SIDs cannot get several of the SIDs resolved on a host which is not an AD member - and never will. A couple if years ago when I was programming an IIS/C#/ASP intranet application and was faced with the same problem of showing only files readable by the logged in user (or rather the IIS impersonated one) and needed an is_readable() equivalent in C#. I ditched calling all the built in ACL check functions and just opened the file for reading without doing anything. eg, the PHP equivalent of: function is_readable(string $file_in): bool { try { if(is_resource($handle=fopen($file_in, "r"))) { fclose($handle); return true; } return false; } catch(Exception $ex) { return false; } } I predicted the worst performance wise and expected the logs being full of rejected read attempts, but the code was snappy even with thousands of files in the remote directory and nothing was logged. A simple solution to a tricky problem I guess, but I have no idea if this could be the solution to this bug too. My C/C++ is far too rusty... ------------------------------------------------------------------------ [2016-11-21 11:38:41] ab@php.net Thanks for the report. I was hunting this bug earlier, however it didn't come to a distinct solution. It still looks to me, this ticket is a duplicate of bug #68926, so still either Samba or a config issue. Probably hard to say, without having some debug session, and creating a reproduce environment is probably the most tricky part. Thanks. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=73543 -- Edit this bug report at https://bugs.php.net/bug.php?id=73543&edit=1

« previous php.bugs (#239702) next »