ID:               43380
 Updated by:       [EMAIL PROTECTED]
 Reported By:      orlandu96 at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Filesystem function related
 Operating System: Windows XP SP2
 PHP Version:      5.2.5
 New Comment:

Try checking the current working directory using getcwd(). I bet it's
not what you expect.


Previous Comments:
------------------------------------------------------------------------

[2007-11-22 17:58:02] orlandu96 at gmail dot com

Description:
------------
file_exists() always returns false for relative URIs when called in a
class destructor.

Reproduce code:
---------------
class test {
        public $file = 'index.php';
        
        function checkFile() {
                if(file_exists($this->file)) {
                        echo "{$this->file} exists";
                } else {
                        echo "{$this->file} doesn't exist";
                }
                echo "\n";
        }

        function __destruct() {
                echo 'test::__destruct() : ';
                $this->checkFile();
                echo 'test::__destruct() : ';
                if(file_exists(__FILE__)) {
                        echo __FILE__, ' exists';
                } else {
                        echo __FILE__, ' doesn\'t exist';
                }
        }
}

$test = new test;
echo 'test::checkFile() : ';
$test->checkFile();

Expected result:
----------------
test::checkFile() : index.php exists
test::__destruct() : index.php exists
test::__destruct() : C:\xampp\htdocs\templating\index.php exists

Actual result:
--------------
test::checkFile() : index.php exists
test::__destruct() : index.php doesn't exist
test::__destruct() : C:\xampp\htdocs\templating\index.php exists


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43380&edit=1

Reply via email to