php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62199 is_readable() does not seem to tolerate crossing partitions inside a sambashare
Submitted: 2012-05-31 17:43 UTC Modified: 2023-11-16 11:03 UTC
Votes:21
Avg. Score:4.7 ± 0.6
Reproduced:21 of 21 (100.0%)
Same Version:10 (47.6%)
Same OS:8 (38.1%)
From: moodboom at gmail dot com Assigned:
Status: Re-Opened Package: *Directory/Filesystem functions
PHP Version: 7.2.11 OS: linux (gentoo)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-05-31 17:43 UTC] moodboom at gmail dot com
Description:
------------
Calls to PHP's is_readable() function are returning false on a directory that is readable from the command prompt. I have changed permissions to most-permissible and still no luck.

Any directory under the samba share that is not on the physical primary partition seems to fail. 

Here are the permissions as provided in the shell:

ls -lad /remote/samba_share
drwxrwxr-x 13 me users 0 May 29 15:49 /remote/samba_share

ls -la /remote/samba_share
drwxr-xr-x  4 me users 0 May  8 14:19 /remote/samba_share/local_dir
drwxr-xr-x 16 me users 0 May 14 19:49 /remote/samba_share/second_drive
drwxrwxrwx 12 me users 0 May 30 09:42 /remote/samba_share/ext_raid

NOTE: I started this as a question on stackoverflow, because of the number of other possible causes, but led to this bug report.

http://stackoverflow.com/questions/10818770/php-is-readable-fails-on-readable-samba-directory



Test script:
---------------
if (is_readable('/remote/samba_share'              )){ echo "share ok\n";  } else { echo "share BAD\n";  }
if (is_readable('/remote/samba_share/local_dir'    )){ echo "local ok\n";  } else { echo "local BAD\n";  }
if (is_readable('/remote/samba_share/second_drive' )){ echo "second ok\n"; } else { echo "second BAD\n"; }
if (is_readable('/remote/samba_share/ext_raid'     )){ echo "raid ok\n";   } else { echo "raid BAD\n";   }

Expected result:
----------------
share ok
local ok
second ok
raid ok

Actual result:
--------------
share ok
local ok
second BAD
raid BAD

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-31 18:05 UTC] moodboom at gmail dot com
Note that the C function access() (which I believe is used by is_readable()) works as expected:

C code: 

cout << "share: " << access("/remote/samba_share", R_OK) << endl; 
cout << "local: " << access("/remote/samba_share/local_dir", R_OK) << endl; 
cout << "second: " << access("/remote/samba_share/second_drive", R_OK) << endl; 
cout << "raid: " << access("/remote/samba_share/ext_raid", R_OK) << endl;

result: 

share: 0
local: 0
second: 0
raid: 0
 [2012-05-31 18:05 UTC] moodboom at gmail dot com
-: m at thedigitalmachine dot com +: moodboom at gmail dot com
 [2013-01-24 07:50 UTC] lukx at lukx dot de
Bug #49620 seems to be similar and offers some more test cases.
 [2018-07-08 14:49 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-07-08 14:49 UTC] cmb@php.net
Does this problem still persist for actively supported PHP
versions[1]?

[1] <http://php.net/supported-versions.php>
 [2018-08-26 16:57 UTC] cmb@php.net
-Status: Feedback +Status: No Feedback
 [2018-08-26 16:57 UTC] cmb@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2018-10-16 12:11 UTC] sln at easyinspect dot io
The problem still persists in version 7.2.11
 [2018-10-16 12:21 UTC] cmb@php.net
-Status: No Feedback +Status: Re-Opened -PHP Version: 5.3.13 +PHP Version: 7.2.11 -Assigned To: cmb +Assigned To:
 [2018-10-16 12:21 UTC] cmb@php.net
Thanks!  Re-opening.
 [2020-01-13 20:06 UTC] flip101 at gmail dot com
This problem still exists in PHP 7.3.11
It also happens when the samba share is mounted to a drive (map network drive) in windows 10 64bits.
 [2021-09-28 13:11 UTC] kemal dot djakman at xxtract dot com
Just to report that the problem still exist in PHP 8.0 on Windows 10 with network mapped drive of a SMB share.

The functions scandir() and is_dir() have no problem, but is_readable() still returns false.
 [2021-10-07 13:06 UTC] cmb@php.net
The related Windows issue is already tracked as bug #73543; this
is about POSIX systems, and while the underlying issue *might*
have similar issues, the exact cause is likely different.
 [2023-11-16 11:03 UTC] bukka@php.net
-Package: Directory function related +Package: *Directory/Filesystem functions
 [2023-11-16 11:03 UTC] bukka@php.net
Slight change of package so it's with other similar issues.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC