From:             info at silisoftware dot com
Operating system: Windows XP Pro SP2
PHP version:      4.4.2
PHP Bug Type:     Filesystem function related
Bug description:  tempnam() creates file on wrong drive

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 bug report at http://bugs.php.net/?id=36290&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36290&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36290&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36290&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36290&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36290&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36290&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36290&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36290&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36290&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36290&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36290&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36290&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36290&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36290&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36290&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36290&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36290&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36290&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36290&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36290&r=mysqlcfg

Reply via email to