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