From: registrace at koren dot cz Operating system: Linux PHP version: 5.2.6 PHP Bug Type: Filesystem function related Bug description: is_writable() returns bogus result
Description: ------------ PHP Function is_writable() sometimes reports false results. Requirements: Linux - getuid() != geteuid() After inspection of PHP source, I realized, that is_writable() internally uses syscall access(2). In turn, access(2) man page (on Linux) says: The check is done with the calling processâs real UID and GID, rather than with the effective IDs as is done when actually attempting an operation. This is to allow set-user-ID programs to easily determine the invoking userâs authority. Reproduce code: --------------- <? $file = "testfile.txt"; echo "GetUID: " . posix_getuid() . "/" . posix_geteuid() . "<br />"; echo "file is writable " . (is_writable($file)?"TRUE":"FALSE") . "<br />"; fopen("testfile.txt", 'wt'); echo ("file created"); ?> Expected result: ---------------- Expected result: either: file is writable TRUE file created or file is writable FALSE ERROR Actual result: -------------- GetUID: 933/10099 file is writable FALSE file created -- Edit bug report at http://bugs.php.net/?id=46498&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46498&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46498&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46498&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46498&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46498&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46498&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46498&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46498&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46498&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46498&r=support Expected behavior: http://bugs.php.net/fix.php?id=46498&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46498&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46498&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46498&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46498&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46498&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46498&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46498&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46498&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46498&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46498&r=mysqlcfg