php.net |  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
Votes:52
Avg. Score:3.4 ± 1.2
Reproduced:20 of 28 (71.4%)
Same Version:9 (45.0%)
Same OS:2 (10.0%)
From: schwarzenneger at hotmail dot com Assigned: cmb
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:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-05-11 12:40 UTC] schwarzenneger at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.is-writable
---

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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] cmb@php.net
-Status: Open +Status: Feedback
 [2016-06-06 19:51 UTC] cmb@php.net
> It seems to be fixed in 5.4.20.

@schwarzenneger: can you confirm?
 [2016-06-15 00:23 UTC] cmb@php.net
-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-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC