From: elettrico at diciannove dot net
Operating system: Linux
PHP version: 5.2.6
PHP Bug Type: Filesystem function related
Bug description: tempnam silently fail
Description:
------------
I'm setting up a virtualhost with this configuration:
php_admin_value open_basedir
"/home/data/web/tdo:/home/data/tdo/tmp:/home/sys/apache2/errorpages/:/usr/lib/php/:/tmp"
php_admin_value doc_root "/home/data/web/tdo/"
php_admin_value include_path
"/home/data/web/tdo/:/home/sys/apache2/errorpages/:/usr/lib/php/"
php_admin_value session.save_path "/home/data/tdo/sess/"
php_admin_value upload_tmp_dir "/home/data/tdo/tmp/"
a simple page that try to do a fopen and after a fwrite fail to execute,
after investigating a little I'll see that it's the tempnam() function that
fail, after fail the fopen, also without issuing any error, and finally the
fwrite, that fire ad error:
Warning: fwrite(): supplied argument is not a valid stream resource in
/home/data/web/tdo/test.php on line 7
Warning: fclose(): supplied argument is not a valid stream resource in
/home/data/web/tdo/test.php on line 8
I don't see any problem in my configuration nor in my code, my php version
is the version of the debian package:
PHP 5.2.0-8+etch11 (cli) (built: May 10 2008 10:35:46)
Reproduce code:
---------------
$tmpfname = tempnam("", "");
//it's the same with $tmpfname = tempnam("*", "");
$handle = fopen($tmpfname, "w");
fwrite($handle, "writing to tempfile");
fclose($handle);
Expected result:
----------------
A file opened in the system TMPDIR (/tmp) or an error.
--
Edit bug report at http://bugs.php.net/?id=45316&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45316&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45316&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45316&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45316&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45316&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45316&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45316&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45316&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45316&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45316&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45316&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45316&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45316&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45316&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45316&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45316&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45316&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45316&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45316&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45316&r=mysqlcfg