note 91521 deleted from function.register-shutdown-function by danbrown

From: Date: Mon, 15 Jun 2009 03:08:10 +0000
Subject: note 91521 deleted from function.register-shutdown-function by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156865@lists.php.net to get a copy of this message
Note Submitter: Cezary Tomczak ---- There is a mibehavior on different configurations of php, when you call exit (outside of registered function), the registered function will / or will not be executed. There are some code examples in comments on this page, showing that after exit (outside of registered func) registered functions are called, but I've made some tests and it doesn't work on Windows with Apache2 and php5 installed as module. I've submitted a bug about this, and jani @ php developer answered me with this: "Expected behaviour. exit() is supposed to exit immediately. Nothing is supposed to be run after you call exit." (http://bugs.php.net/bug.php?id=48475) Here is the code example, and tests on a few different configurations: <?php function shutdown() { file_put_contents(dirname(__FILE__).'/shutdown.txt', time()); } register_shutdown_function('shutdown'); exit(); ?> 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 -------- Seems like there is an unexpected behavior on most platforms. Only Win+Apache+php5 as mod behaves correctly. That is what jani@php.net states.

« previous php.notes (#156865) next »