From:             alexandre_langlois at hotmail dot com
Operating system: Windows XP Pro
PHP version:      4.3.10
PHP Bug Type:     Filesystem function related
Bug description:  register_shutdown_function, stop access to files

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 bug report at http://bugs.php.net/?id=32412&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32412&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32412&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32412&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32412&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32412&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32412&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32412&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32412&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32412&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32412&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32412&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32412&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32412&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32412&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32412&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32412&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32412&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32412&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32412&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32412&r=mysqlcfg

Reply via email to