Bug #70467 [NEW]: is_readable wrong results on a samba share

From: Date: Wed, 09 Sep 2015 10:25:55 +0000
Subject: Bug #70467 [NEW]: is_readable wrong results on a samba share
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195902@lists.php.net to get a copy of this message
From: ced at bernispa dot com Operating system: Windows Server 2012 PHP version: 5.6.13 Package: Streams related Bug Type: Bug Bug description:is_readable wrong results on a samba share Description: ------------ Switching from php 5.2.17 to 5.6.12 phpmailer started having problems sending attachments stored on a samba server joined to an Active Directory domain and referenced by UNC paths. The problem is not with phpmailer but with an is_readable() calls that it does on the files to be attached: it now returns false where with 5.2.17 returned true. For many files on that samba file server now is_readable() returns false, even if they can be regularly be openend by php and file_exists() reports true. From my tests looks like is_readable() doesn't really tests the file readability but does something like this: it gets the UID/GID of the php process and then compares it with the ACLs of the requested file. But my samba server has an historically setup where on some shares the php user/group is not mentioned on any ACLs because it is in the "admin users" directive inside smb.conf. From smb.conf(5): ----------------------- This is a list of users who will be granted administrative privileges on the share. This means that they will do all file operations as the super-user (root). You should use this option very carefully, as any user in this list will be able to do anything they like on the share, irrespective of file permissions. ----------------------- With permissions defined like that, is_readable() wrongly reports that the file is not readable while it is. I haven't tested it but i suspect that also is_writable() has the same problem. -- Edit bug report at https://bugs.php.net/bug.php?id=70467&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70467&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70467&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70467&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70467&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70467&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70467&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70467&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70467&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70467&r=support Expected behavior: https://bugs.php.net/fix.php?id=70467&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70467&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70467&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70467&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70467&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70467&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70467&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70467&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70467&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70467&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70467&r=mysqlcfg

« previous php.bugs (#195902) next »