From: mpb dot mail at gmail dot com Operating system: Linux PHP version: 4.4.4 PHP Bug Type: Filesystem function related Bug description: tempnam creates file with access permissions mode of 0600
Description: ------------ The tempnam function sets the access permissions mode of the file it creates to 0600. This behavior is undocumented and is different from the behavior of fopen, which sets the access permissions mode to 0644. tempnam's behavior is therefore either a bug or an undocumented "feature". If you consider this to be a "feature" and not a bug, please reclassify this bug report as a documentation request. The revelant source files are: ext/standard/file.c main/php_open_temporary_file.c 'man mkstemp' is also interesting reading, as mkstemp behaves differently in different versions of glibc. Thank you! Reproduce code: --------------- <?php fopen ('test.txt', 'w'); tempnam ('.', 'test-'); print '<pre>'; print `ls -ln test.txt test-*`; print '</pre>'; ?> Expected result: ---------------- -rw-r--r-- 1 1424351 293975 0 Jan 28 23:08 test-ZG6Vdl -rw-r--r-- 1 1424351 293975 0 Jan 28 23:08 test.txt Actual result: -------------- -rw------- 1 1424351 293975 0 Jan 28 23:08 test-ZG6Vdl -rw-r--r-- 1 1424351 293975 0 Jan 28 23:08 test.txt -- Edit bug report at http://bugs.php.net/?id=40267&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40267&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40267&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40267&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40267&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40267&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40267&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40267&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40267&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40267&r=support Expected behavior: http://bugs.php.net/fix.php?id=40267&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40267&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40267&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40267&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40267&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40267&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40267&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40267&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40267&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40267&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40267&r=mysqlcfg