ID: 36290
Comment by: hanskrentel at yahoo dot de
Reported By: info at silisoftware dot com
Status: No Feedback
Bug Type: Filesystem function related
Operating System: Windows XP Pro SP2
PHP Version: 4.4.2
New Comment:
I just checked this out on PHP Version 5.1.2 and the behavior for me is
the same, so this was not fixed.
reproduced with:
$tempname = tempnam('', 'foo');
echo $tempname.'<br>';
echo realpath($tempname).'<br>';
output in my case:
\foo5E0.tmp
d:\foo5E0.tmp
d:\ is not my tempdir
anyway this function behaves inconsisten per default as discribben in
the current online documentaion:
>>Creates a file with a unique filename in the specified directory. If
the directory does not exist, tempnam() may generate a file in the
system's temporary directory, and return the name of that.<<
http://www.php.net/manual/en/function.tempnam.php
so the behavior is correct per definition but useless and i guess not
intended.
Previous Comments:
------------------------------------------------------------------------
[2006-02-13 01:00:04] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-02-05 10:31:29] [EMAIL PROTECTED]
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
------------------------------------------------------------------------
[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