From: Operating system: Linux PHP version: 5.2.13 Package: *Directory/Filesystem functions Bug Type: Feature/Change Request Bug description:is_writable is confusing, should NOT check if the file exists or not
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 bug report at http://bugs.php.net/bug.php?id=51442&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51442&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51442&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51442&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51442&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51442&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51442&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51442&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51442&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51442&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51442&r=support Expected behavior: http://bugs.php.net/fix.php?id=51442&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51442&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51442&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51442&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51442&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51442&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51442&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51442&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51442&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51442&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51442&r=mysqlcfg