|  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: 2016-06-26 04:22 UTC
Avg. Score:3.3 ± 1.2
Reproduced:28 of 44 (63.6%)
Same Version:15 (53.6%)
Same OS:5 (17.9%)
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
 [2016-06-26 04:22 UTC] php-bugs at lists dot php dot 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.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Mar 09 08:01:24 2021 UTC