Bug #68926 [Opn->Ana]: is_writable returns false but file_put_contents works

From: Date: Thu, 12 Feb 2015 19:01:00 +0000
Subject: Bug #68926 [Opn->Ana]: is_writable returns false but file_put_contents works
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190634@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68926&edit=1 ID: 68926 Updated by: ab@php.net Reported by: lukyer at gmail dot com Summary: is_writable returns false but file_put_contents works -Status: Open +Status: Analyzed Type: Bug Package: *Directory/Filesystem functions Operating System: Windows 8 64b Prof. PHP Version: 5.6Git-2015-01-27 (Git) Block user comment: N Private report: N New Comment: I've spent some time on debugging this and can confirm. The reason for this behavior is here https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/ChangeNotes.html#id2578661 . You probably could check that - you use samba3 or above - the folder owner is mapped to something like "nobody", with either full or restricted access rights (use right click -> security -> advanced) You also could play with the access rights on the linux machine, just to see whether it changes something in PHP behavior. 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. We could currently look whether it's possible to cover this part within PHP. In general it looks more like samba compat issue, because as you've mentioned - the native shares work well. Regards Previous Comments: ------------------------------------------------------------------------ [2015-01-29 07:12:51] lukyer at gmail dot com Drive Z in my case is Samba mapped drive using "Map network drive" function in Windows Explorer. "tmp (\\192.168.0.15\bughunt)". Any other drives works as expected. Just network Samba drives are problematic. var_dump(is_writable('Z:\tmp')); var_dump(file_put_contents('Z:\tmp\hello.txt', 'hello')); output: bool(false) int(5) ------------------------------------------------------------------------ [2015-01-28 14:53:10] ab@php.net Cannot reproduce here: var_dump(is_writable('p:\tmp')); var_dump(file_put_contents('p:\tmp\hello.txt', 'hello')); this delivers bool(true) int(5) @lukyer please check what exactly is causing this behavior and provide some more data, so we can reproduce and debug. Thanks. ------------------------------------------------------------------------ [2015-01-27 21:38:42] lukyer at gmail dot com Description: ------------ When samba drive is mapped in Windows, call to is_writable returns false on folders and files although these are actually writable. is_readable seems working ok. Test script: --------------- echo is_writeable("Z://fdvtest"); // returns 0 file_put_contents("Z://fdvtest/file", "content"); // works fine ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68926&edit=1

« previous php.bugs (#190634) next »