From:             cagret at gmail dot com
Operating system: Win/Linux/Apache/Lighttpd
PHP version:      5.2.9
PHP Bug Type:     Unknown/Other Function
Bug description:  register_shutdown_function random behavior on different 
platforms after exit

Description:
------------
Function registered with register_shutdown_function() sometimes is
executed / sometimes it is not, after you exit (outside of registered
function) - depends on php configuration.

Win+Apache+php5 as mod - shutdown.txt IS NOT created.
Win+Apache+php5 as cgi - shutdown.txt IS created
Win+Apache+php4 as mod - shutdown.txt IS created
Win+Lighttpd+php5 as fcgi - shutdown.txt IS created
Linux+Apache+php4 as mod - shutdown.txt IS created
Linux+Lighttpd+php5 as fcgi - shutdown.txt IS created

I've thought this is a bug on Win+Apache+php5asmod, and reported it, but
[email protected] (http://bugs.php.net/bug.php?id=48475) says it is an expected
behavior: "Expected behaviour. exit() is supposed to exit immediately.
Nothing is supposed to be run after you call exit."

If this is an expected behavior, then seems like there is a bug on other
php configurations.

Reproduce code:
---------------
<?php
function shutdown()
{
        file_put_contents(dirname(__FILE__).'/shutdown.txt', time());
}
register_shutdown_function('shutdown');
exit();
?>

Expected result:
----------------
shutdown.txt should not be created.

Actual result:
--------------
shutdown.txt is created

-- 
Edit bug report at http://bugs.php.net/?id=48552&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48552&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48552&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48552&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48552&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48552&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48552&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48552&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48552&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48552&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48552&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48552&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48552&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48552&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48552&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48552&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48552&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48552&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48552&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48552&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48552&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48552&r=mysqlcfg

Reply via email to