Edit report at http://bugs.php.net/bug.php?id=30210&edit=1
ID: 30210 Comment by: pinaki17 at gmail dot com Reported by: m dot leuffen at i-line dot net Summary: Destructor resetting working-directory Status: Bogus Type: Bug Package: Directory function related Operating System: Linux PHP Version: 5.0.1 Block user comment: N Private report: N New Comment: I know this is a old thread but the issue still exists. How can this possibly be not a bug? The current working directory is where all the include file dependencies are related to. How would you justify resetting it? Also what logic goes behind it? As i understand, i can set the working directory again in the destructor and write the code and all these objects will be gc'ed once the page dies, so why have the reset happen before the destructor? Previous Comments: ------------------------------------------------------------------------ [2004-09-23 20:27:49] he...@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 The destructor is called during shutdown. If you require certain behavior the unset() your object before the script terminates. ------------------------------------------------------------------------ [2004-09-23 16:31:11] m dot leuffen at i-line dot net Description: ------------ Hi. In __destruct() function the working-directory is default set to root ('/'). Bye, Matthias Reproduce code: --------------- class Test { public function __construct() { echo "Constructor: ".getcwd(); } public function __destruct() { echo "\nDestructor: ".getcwd(); } } $obj = new Test(); Expected result: ---------------- Constructor: /home/xyz/dir Destructor: /home/xyz/dir Actual result: -------------- Constructor: /home/xyz/dir Destructor: / ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=30210&edit=1