#35816 [NEW]: file_put_contents() in __destructor-calls writes to SERVER_ROOT

From: Date: Tue, 27 Dec 2005 08:39:36 +0000
Subject: #35816 [NEW]: file_put_contents() in __destructor-calls writes to SERVER_ROOT
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91097@lists.php.net to get a copy of this message
From:             alexander at alexautonet dot nl
Operating system: Windows XP SP2
PHP version:      5.1.1
PHP Bug Type:     Filesystem function related
Bug description:  file_put_contents() in __destructor-calls writes to SERVER_ROOT

Description:
------------
The file_put_contents()-function writes to SERVER_ROOT; not to the same
path the script is running in. I'll use this for debug-mode (to write
SQL-query-logs and other variables to txtfiles).'
I'm using PHP 5.1.1 as loaded module in Apache 2.0.55 on Win32.

Reproduce code:
---------------
<?php
class test
{
	function __destruct()
	{
		//	Writes to SERVER_ROOT (!!)
		file_put_contents("testing.txt","Blabla");
	}
}

$x = new test();
?>

Expected result:
----------------
testing.txt has to be written in the executed path.

Actual result:
--------------
testing.txt is written in SERVER_ROOT of Apache2.

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


Thread (3 messages)

« previous php.bugs (#91097) next »