From:             ruslan_y at list dot ru
Operating system: Windows XP SP2
PHP version:      5.2.0
PHP Bug Type:     *Directory/Filesystem functions
Bug description:  tempnam() unexpected behavior 

Description:
------------
After the upgrade from old php 4.x to 5.2.0. Some of my web scripts stop
working. One of the reason is the changes in tempnam() behavior which stop
working with local path like "./dir" or "dir/" and force me to add system
temporary folder to open_basedir path.

Configuration: 
Windows XP SP2 | PHP 5.2.0 | Apache 2.0.55 (+ php5apache2.dll)

P.S. php.exe works as expected (except DOCUMENT_ROOT is null) 
(php.exe -q 1.php)

Reproduce code:
---------------
<?php
if (!is_dir('2')) mkdir('2');

$tmpfname1 = tempnam('2/', "FOO");
$tmpfname2 = tempnam('./2/', "FOO");
$tmpfname3 = tempnam('2\\', "FOO");
$tmpfname4 = tempnam('.\2', "FOO");
$tmpfname5 = tempnam('C:\root\www\host2\www\2\\', "FOO");

echo '<pre>'."\n";
echo 'DOCUMENT_ROOT = '.$_SERVER['DOCUMENT_ROOT']."\n";
echo '$tmpfname1 = '.$tmpfname1."\n";
echo '$tmpfname2 = '.$tmpfname2."\n";
echo '$tmpfname3 = '.$tmpfname3."\n";
echo '$tmpfname4 = '.$tmpfname4."\n";
echo '$tmpfname5 = '.$tmpfname5."\n";
echo '</pre>'."\n";
?>

Expected result:
----------------
A new directory "2" and five files in it.

DOCUMENT_ROOT = C:/root/www/host2/www
$tmpfname1 = 2/FOOFA.tmp
$tmpfname2 = ./2/FOOFB.tmp
$tmpfname3 = 2\FOOFC.tmp
$tmpfname4 = .\2\FOOFD.tmp
$tmpfname5 = C:\root\www\host2\www\2\FOOFE.tmp

Actual result:
--------------
A new directory "2" and only one file in it. all other files in the
windows temp folder.

DOCUMENT_ROOT = C:/root/www/host2/www
$tmpfname1 = C:\WINDOWS\TEMP\FOO10A.tmp
$tmpfname2 = C:\WINDOWS\TEMP\FOO10B.tmp
$tmpfname3 = C:\WINDOWS\TEMP\FOO10C.tmp
$tmpfname4 = C:\WINDOWS\TEMP\FOO10D.tmp
$tmpfname5 = C:\root\www\host2\www\2\FOO10E.tmp

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

Reply via email to