php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35661 Object-element-functions does not handle directories correctly
Submitted: 2005-12-13 19:46 UTC Modified: 2005-12-13 20:23 UTC
From: marscel at pcreact dot de Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 5.1.1 OS: Windows XP SP1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: marscel at pcreact dot de
New email:
PHP Version: OS:

 

 [2005-12-13 19:46 UTC] marscel at pcreact dot de
Description:
------------
I have a member function which is been called in the destructor of this object. The called function has to write a string into a file, which shall be stored in a subdirectory. 
In my case its F:\php\logs (php is the dir where the script is stored, in the \logs dir shall the created file be stored). The first problem I recognized was that PHP can't read the current directory in the function, the second one is that it creates files in a totally different directory. If I tell this function "mkdir("./logs/");", it won't create a subdir called "logs" in F:\php, but in D:\ (-> D:\logs)! 
If I write the absolute directory, the thing works, but it's useless on a webspace.
My php.ini hasn't set anything to D:\ just PHP is installed in D:\php\

Reproduce code:
---------------
class someclass
{   // Constructors, functions, vars...
    public function someclass_make_file($mode)    {
        if(defined('DEBUG_LOG')) { 
			switch($mode)  { 
				case 3:
	  $dl = $this->debug_log;  // "Info"
	  $dfl = fopen("logs/".time().".txt", "a");
        fwrite($dfl, $dl);
	  fclose($dfl); 
	  break;
			}
		}
		return true;
    }
    public funtion __construct()
    {
       $this->someclass_make_file(3)
    }
}


Expected result:
----------------
A file F:\php\logs\1134123412.txt

Actual result:
--------------
A file D:\logs\1134123412.txt or non has been created.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-13 20:23 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 23:01:30 2024 UTC