#40267 [Opn]: tempnam creates file with access permissions mode of 0600

From: Date: Mon, 29 Jan 2007 07:58:35 +0000
Subject: #40267 [Opn]: tempnam creates file with access permissions mode of 0600
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969375083@lists.php.net to get a copy of this message
ID: 40267 Updated by: tony2001@php.net Reported By: mpb dot mail at gmail dot com Status: Open -Bug Type: Filesystem function related +Bug Type: Documentation problem Operating System: Linux PHP Version: 4.4.4 New Comment: Reclassified as docu problem. Previous Comments: ------------------------------------------------------------------------ [2007-01-29 07:27:20] mpb dot mail at gmail dot com 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 this bug report at http://bugs.php.net/?id=40267&edit=1

« previous php.doc (#969375083) next »