php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35816 file_put_contents() in __destructor-calls writes to SERVER_ROOT
Submitted: 2005-12-27 09:39 UTC Modified: 2005-12-27 10:33 UTC
From: alexander at alexautonet dot nl Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.1.1 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alexander at alexautonet dot nl
New email:
PHP Version: OS:

 

 [2005-12-27 09:39 UTC] alexander at alexautonet dot nl
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-27 09:48 UTC] alexander at alexautonet dot nl
I tested also with flag 'FILE_USE_INCLUDE_PATH' but that doesn't work; it writes also in SERVER_ROOT.
 [2005-12-27 10:33 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 06:01:35 2024 UTC