#32412 [Opn->Bgs]: register_shutdown_function, stop access to files
| From: | sniper@php.net | Date: | Tue, 22 Mar 2005 17:32:54 +0000 |
| Subject: | #32412 [Opn->Bgs]: register_shutdown_function, stop access to files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-77206@lists.php.net to get a copy of this message | ||
ID: 32412
Updated by: sniper@php.net
Reported By: alexandre_langlois at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Windows XP Pro
PHP Version: 4.3.10
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2005-03-22 17:24:18] alexandre_langlois at hotmail dot com
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32412&edit=1