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: 2021-04-19 14:14 UTC
Votes:96
Avg. Score:3.3 ± 1.2
Reproduced:30 of 49 (61.2%)
Same Version:17 (56.7%)
Same OS:6 (20.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
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 !
Your email address:
MUST BE VALID
Solve the problem:
24 + 34 = ?
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

Pull Requests

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
 [2021-08-22 06:23 UTC] gustavowoltmann123 at gmail dot com
Thank you soo much to post these types of informational posts. In this article, you are talking about 'good information about the Hotmail dot com. Now this time, online business is more popular, and more people like to do this business. Because with the help of this, We can earn huge money and digital marketing is the biggest example of online business. Most people are focusing on this type of business and It's good for business growth. Here we are talking about 'Hire android app developer in der-Ukraine. It should be in your knowledge that the android app service is related to information technologies. The name of this consulting system has become popular in the whole globe which relates to technology and development. I always feel excited to see these types of helpful articles. In this article, I want to share the good working process of the android app developers, because it's very important for everyone. For more detail, You can visit https://mobilunity.de/android-app-developer-in-der-ukraine/site. This is very important for everyone
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 11 10:01:28 2024 UTC