#35661 [NEW]: Object-element-functions does not handle directories correctly

From: Date: Tue, 13 Dec 2005 18:46:34 +0000
Subject: #35661 [NEW]: Object-element-functions does not handle directories correctly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90380@lists.php.net to get a copy of this message
From: marscel at pcreact dot de Operating system: Windows XP SP1 PHP version: 5.1.1 PHP Bug Type: Directory function related Bug description: Object-element-functions does not handle directories correctly 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. -- Edit bug report at http://bugs.php.net/?id=35661&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35661&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35661&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35661&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35661&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35661&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35661&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35661&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35661&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35661&r=support Expected behavior: http://bugs.php.net/fix.php?id=35661&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35661&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35661&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35661&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35661&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35661&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35661&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35661&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35661&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35661&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35661&r=mysqlcfg

« previous php.bugs (#90380) next »