#42049 [Opn->Fbk]: tempnam() creates a file with incorrect default permissions on Windows.

From: Date: Thu, 19 Jul 2007 16:07:22 +0000
Subject: #42049 [Opn->Fbk]: tempnam() creates a file with incorrect default permissions on Windows.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115242@lists.php.net to get a copy of this message
ID: 42049 Updated by: jani@php.net Reported By: mahesh dot vemula at in dot ibm dot com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Windows XP PHP Version: 5CVS-2007-07-19 (snap) New Comment: I think it's how chmod on windows works. Try this: <?php $file_name = tempnam(".", "temp"); chmod($file_name, 0600); clearstatcache(); printf("%o", fileperms($file_name) ); ?> I bet you still get 0666.. Previous Comments: ------------------------------------------------------------------------ [2007-07-19 14:43:46] mahesh dot vemula at in dot ibm dot com Description: ------------ The unique file created by tempnam() has the default permissions of 0666 on Windows. But according to documentation http://in.php.net/manual/en/function.tempnam.php, the default permissions are 0600. On Linux tempnam() creates a file with permissions of 0600 as expected i.e according to documentation. If this is the expected behavior on Windows, please fix the documentation. Reproduce code: --------------- <?php $file_name = tempnam(".", "temp"); printf("%o", fileperms($file_name) ); unlink($file_name); ?> Expected result: ---------------- 100600 Actual result: -------------- 100666 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42049&edit=1

« previous php.bugs (#115242) next »