ID: 45316
User updated by: elettrico at diciannove dot net
Reported By: elettrico at diciannove dot net
Status: Open
Bug Type: Filesystem function related
Operating System: Linux
PHP Version: 5.2.6
New Comment:
I've tested today, it's the same thing with Apache/2.2.8 and
PHP/5.2.5-3 (debian lenny package)
Previous Comments:
------------------------------------------------------------------------
[2008-06-19 14:51:17] elettrico at diciannove dot net
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 this bug report at http://bugs.php.net/?id=45316&edit=1