|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-22 18:32 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 11:00:02 2025 UTC |
Description: ------------ I use register_shutdown_function to simulate a destructor, but, in this destructor, I cannot check if a file exist, this function (file_exists) like is_reading, is_file ... always return FALSE... To verify if it's a problem with my file, I put the same check in the constructor, and it work, the file exist, so, I put clearstatcache() in the constructor to remove file information in the cache because, in the destructor, php will say, that file exist, I saw it before, but PHP will not really check if the file exist. BUT, if, in the destructor, I put the absolute path to check the file (like E:/tpls/debug.tpl), the destructor see the file... WHY ??? Reproduce code: --------------- <?php class test { function test() { if (file_exists('tpls/debug.tpl')) { clearstatcache(); echo 'CONSTRUCTOR: FILE > TRUE'; } else { echo 'CONSTRUCTOR: FILE > FALSE'; } register_shutdown_function(array(&$this,'_test')); } function _test() { if (file_exists('tpls/debug.tpl')) { echo ' DESTRUCTOR: FILE > TRUE'; } else { echo ' DESTRUCTOR: FILE > FALSE'; } } } $test =& new test(); ?> Expected result: ---------------- CONSTRUCTOR: FILE > TRUE DESTRUCTOR: FILE > TRUE Actual result: -------------- CONSTRUCTOR: FILE > TRUE DESTRUCTOR: FILE > FALSE