|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-01-29 07:58 UTC] tony2001@php.net
[2007-02-04 13:50 UTC] bjori@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 08:00:01 2025 UTC |
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