From: Operating system: Linux PHP version: 5.3.8 Package: Safe Mode/open_basedir Bug Type: Bug Bug description:tempnam(): wrong fallback to /tmp
Description:
------------
tempnam() should NOT fall back to /tmp if the $dir-param is explicit set to
a real-path inside the open_basedir and because of wrong permissions $dir
is not writeable
Test script:
---------------
<?php
$temp_folder = dirname(__FILE__) . '/temp/';
mkdir($temp_folder);
chmod($temp_folder, 0555);
$tmp_name = str_replace("\\", '/', tempnam($temp_folder, 'rhcsv'));
$fp = fopen($tmp_name, 'wb+');
if($fp)
{
flock($fp, LOCK_EX);
fwrite($fp, 'test');
flock($fp, LOCK_UN);
fclose($fp);
}
?>
Expected result:
----------------
error message that $dir is not writeable
Actual result:
--------------
temporary file is created in /tmp which violates open_basedir and fopen()
is failing with open_basedir restriction messages
--
Edit bug report at https://bugs.php.net/bug.php?id=55804&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55804&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55804&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=55804&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55804&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=55804&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55804&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=55804&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=55804&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=55804&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=55804&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=55804&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=55804&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=55804&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55804&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=55804&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55804&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=55804&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=55804&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=55804&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=55804&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=55804&r=mysqlcfg
