Edit report at http://bugs.php.net/bug.php?id=51442&edit=1

 ID:               51442
 Updated by:       f...@php.net
 Reported by:      mr dot mosch at gmail dot com
 Summary:          is_writable is confusing, should NOT check if the file
                   exists or not
-Status:           Open
+Status:           Wont fix
 Type:             Feature/Change Request
 Package:          *Directory/Filesystem functions
 Operating System: Linux
 PHP Version:      5.2.13

 New Comment:

This would be quite a BC break, won't happen.


Previous Comments:
------------------------------------------------------------------------
[2010-03-30 20:56:16] mr dot mosch at gmail dot com

Description:
------------
If i want to check if the file is writeable even if it not exists, if
have to write an complicated function. if the behavior would change both
cases, file exists and file does not exists would be handled in 1 line
of code.



This is not a test script, should only show up the thing.



// Acutal behavior:

if (is_writeable('/tmp/NOT_EXISTING')) // returns false



// Better behavior:

if (is_writeable('/tmp/NOT_EXISTING')) // returns true



// Actual workaround:

if (is_writeable('/tmp/NOT_EXISTING') ||
(file_exists('/tmp/NOT_EXISTING') === false &&
is_writeable(pathinfo('/tmp/NOT_EXISTING', PATHINFO_DIRNAME))) // return
true





------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51442&edit=1

Reply via email to