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 (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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
48 - 32 = ?
Subscribe to this entry?

 
 [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: Sun Nov 19 01:31:42 2017 UTC