#27609 [Opn->Bgs]: is_writable returns true for file that can not be written to
| From: | wez@php.net | Date: | Wed, 24 Mar 2004 21:33:32 +0000 |
| Subject: | #27609 [Opn->Bgs]: is_writable returns true for file that can not be written to | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56775@lists.php.net to get a copy of this message | ||
ID: 27609
Updated by: wez@php.net
Reported By: gobzo at netscape dot net
-Status: Open
+Status: Bogus
Bug Type: *Directory/Filesystem functions
Operating System: Windows XP Pro
PHP Version: 4.3.5RC3
New Comment:
microsoft c runtime library only reports the read-only flag from its
stat() implementation; if the file is not marked as read-only in the
regular file attributes (eg: what you see using attrib or dir
commands), then PHP (and any other ANSI C program) will see it as
writable.
This is a duplicate of some other bug report (thus marking it as bogus,
since you could have searched harder).
Official view on this problem is "wont fix", since we lack the time and
inclination to mess with NT security API (it's an ugly beast), but
would accept a patch that implements it.
Previous Comments:
------------------------------------------------------------------------
[2004-03-24 16:19:17] gobzo at netscape dot net
Still the same problem with the latest snapshot.
------------------------------------------------------------------------
[2004-03-15 23:05:40] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
And did it work in some previous version of PHP? (which?)
------------------------------------------------------------------------
[2004-03-15 15:53:40] gobzo at netscape dot net
Apology! I mixed up results. They should read:
Expected result:
----------------
Read only
Actual result:
--------------
Writable
------------------------------------------------------------------------
[2004-03-15 15:51:45] gobzo at netscape dot net
Description:
------------
I experience a situation, where Apache runs under the user name, who
does not have rights to write to a certain directory. This has been
tested and found working: I logged in under that user and received
Access denied error trying to save a changed file in this folder.
The problem is that if I call is_writable() against files in that
folder (and the folder itself!), it will return true which it utterly
wrong. Of course, subsequent writes to the files fail because the files
in fact can not be written to, but the scripts do not know about that.
My wild guess would be this is Windows or WinXP related issue, I do not
have a Linux box to check, but if needed, I can set it up - just email
me.
Reproduce code:
---------------
1. Create a folder 'foo' and file 'bar' in that folder.
2. Create a new user User1 and assign his rights to a folder 'foo' so
that his Allow/Write is unchecked.
3. Run Apache under this user.
4. Create ./foo.php with the following code:
<?php
if (is_writable("bar"))
echo "Writable";
else
echo "Read only";
?>
5. Go with your browser to localhost/foo.php
Expected result:
----------------
Writable
Actual result:
--------------
Read only
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27609&edit=1