From:             gobzo at netscape dot net
Operating system: Windows XP Pro
PHP version:      4.3.5RC3
PHP Bug Type:     *Directory/Filesystem functions
Bug description:  is_writable returns true for file that can not be written to

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 bug report at http://bugs.php.net/?id=27609&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27609&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27609&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27609&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27609&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27609&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27609&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27609&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27609&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27609&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27609&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27609&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27609&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27609&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27609&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27609&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27609&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27609&r=float

Reply via email to