#36290 [Opn->Fbk]: tempnam() creates file on wrong drive
| From: | tony2001@php.net | Date: | Sun, 05 Feb 2006 09:31:32 +0000 |
| Subject: | #36290 [Opn->Fbk]: tempnam() creates file on wrong drive | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92922@lists.php.net to get a copy of this message | ||
ID: 36290
Updated by: tony2001@php.net
Reported By: info at silisoftware dot com
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Windows XP Pro SP2
PHP Version: 4.4.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2006-02-05 02:19:00] info at silisoftware dot com
Description:
------------
tempnam() returns a temp filename, and creates the file. However, it
creates it on the wrong drive. For example:
$tempname = tempnam('', 'foo');
echo $tempname.'<br>';
echo realpath($tempname).'<br>';
This outputs:
\foo49.tmp
e:\foo49.tmp
Notice the returned filename has no drive letter. The file is created
(to prevent race condition) in C:\ but realpath() resolves that to E:\
(the last drive letter of physical harddrives in this system).
For reference:
getenv('TMP') == 'C:\WINDOWS\TEMP'
getenv('TMPDIR') == ''
Reproduce code:
---------------
$tempname = tempnam('', 'foo');
echo $tempname.'<br>';
echo realpath($tempname).'<br>';
Expected result:
----------------
c:\foo49.tmp
c:\foo49.tmp
Actual result:
--------------
\foo49.tmp
e:\foo49.tmp
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36290&edit=1