From: orlandu96 at gmail dot com Operating system: Windows XP SP2 PHP version: 5.2.5 PHP Bug Type: Filesystem function related Bug description: incorrect file_exists() results and __destruct()
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 bug report at http://bugs.php.net/?id=43380&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43380&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43380&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43380&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43380&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43380&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43380&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43380&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43380&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43380&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43380&r=support Expected behavior: http://bugs.php.net/fix.php?id=43380&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43380&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43380&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43380&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43380&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43380&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43380&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43380&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43380&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43380&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43380&r=mysqlcfg