|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-11-24 12:24 UTC] jani@php.net
[2007-11-24 12:26 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 12:00:01 2025 UTC |
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