|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54709 is_writable returns false for a directory but php can create files inside it
Submitted: 2011-05-11 12:40 UTC Modified: 2021-04-19 14:14 UTC
Avg. Score:3.3 ± 1.2
Reproduced:29 of 45 (64.4%)
Same Version:16 (55.2%)
Same OS:6 (20.7%)
From: schwarzenneger at hotmail dot com Assigned: cmb (profile)
Status: No Feedback Package: IIS related
PHP Version: 5.3SVN-2011-05-11 (snap) OS: Windows XP SP3/IIS 5.1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-05-11 12:40 UTC] schwarzenneger at hotmail dot com
From manual page:

Quote: Returns TRUE if the filename exists and is writable. The filename argument may be a directory name allowing you to check if a directory is writable. 

Well it did not return true in the following test case. The file system is NTFS.

Test script:
var_dump(is_writeable("C:\\Inetpub\\wwwroot\\simplepiecache"));          // false
var_dump(is_writeable("\\Inetpub\\wwwroot\\simplepiecache"));            // false
var_dump(is_writeable("/Inetpub/wwwroot/simplepiecache"));               // false
var_dump(is_writeable("/Inetpub/wwwroot/simplepiecache/"));              // false

file_put_contents("/Inetpub/wwwroot/mln/simplepiecache/aaa.txt", "bbb"); // DOES create a file aaa.txt containing bbb
echo file_get_contents("/Inetpub/wwwroot/mln/simplepiecache/aaa.txt");   // bbb

Expected result:
var_dump(is_writeable("C:\\Inetpub\\wwwroot\\simplepiecache")); // should be true
var_dump(is_writeable("\\Inetpub\\wwwroot\\simplepiecache"));   // should be true
var_dump(is_writeable("/Inetpub/wwwroot/simplepiecache"));      // should be true
var_dump(is_writeable("/Inetpub/wwwroot/simplepiecache/"));     // should be true


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-07 20:50 UTC] sam at rmcreative dot ru
It seems to be fixed in 5.4.20.
 [2016-06-06 19:51 UTC]
-Status: Open +Status: Feedback
 [2016-06-06 19:51 UTC]
> It seems to be fixed in 5.4.20.

@schwarzenneger: can you confirm?
 [2016-06-15 00:23 UTC]
-Assigned To: +Assigned To: cmb
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jun 25 11:01:24 2021 UTC